package com.naze32.configurator;

import anywheresoftware.b4a.B4AMenuItem;
import android.app.Activity;
import android.os.Bundle;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BALayout;
import anywheresoftware.b4a.B4AActivity;
import anywheresoftware.b4a.ObjectWrapper;
import anywheresoftware.b4a.objects.ActivityWrapper;
import java.lang.reflect.InvocationTargetException;
import anywheresoftware.b4a.B4AUncaughtException;
import anywheresoftware.b4a.debug.*;
import java.lang.ref.WeakReference;

public class main extends Activity implements B4AActivity{
	static main mostCurrent;
	static boolean afterFirstLayout;
	static boolean isFirst = true;
    private static boolean processGlobalsRun = false;
	BALayout layout;
	public static BA processBA;
	BA activityBA;
    ActivityWrapper _activity;
    java.util.ArrayList<B4AMenuItem> menuItems;
	private static final boolean fullScreen = false;
	private static final boolean includeTitle = false;
    public static WeakReference<Activity> previousOne;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		if (isFirst) {
			processBA = new BA(this.getApplicationContext(), null, null, "com.naze32.configurator", "main");
			processBA.loadHtSubs(this.getClass());
	        float deviceScale = getApplicationContext().getResources().getDisplayMetrics().density;
	        BALayout.setDeviceScale(deviceScale);
		}
		else if (previousOne != null) {
			Activity p = previousOne.get();
			if (p != null && p != this) {
                anywheresoftware.b4a.keywords.Common.Log("Killing previous instance (main).");
				p.finish();
			}
		}
		if (!includeTitle) {
        	this.getWindow().requestFeature(android.view.Window.FEATURE_NO_TITLE);
        }
        if (fullScreen) {
        	getWindow().setFlags(android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN,   
        			android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN);
        }
		mostCurrent = this;
        processBA.activityBA = null;
		layout = new BALayout(this);
		setContentView(layout);
		afterFirstLayout = false;
		BA.handler.postDelayed(new WaitForLayout(), 5);

	}
	private static class WaitForLayout implements Runnable {
		public void run() {
			if (afterFirstLayout)
				return;
			if (mostCurrent.layout.getWidth() == 0) {
				BA.handler.postDelayed(this, 5);
				return;
			}
			mostCurrent.layout.getLayoutParams().height = mostCurrent.layout.getHeight();
			mostCurrent.layout.getLayoutParams().width = mostCurrent.layout.getWidth();
			afterFirstLayout = true;
			mostCurrent.afterFirstLayout();
		}
	}
	private void afterFirstLayout() {
		activityBA = new BA(this, layout, processBA, "com.naze32.configurator", "main");
        processBA.activityBA = new java.lang.ref.WeakReference<BA>(activityBA);
        _activity = new ActivityWrapper(activityBA, "activity");
        anywheresoftware.b4a.Msgbox.isDismissing = false;
        initializeProcessGlobals();		
        initializeGlobals();
        anywheresoftware.b4a.objects.ViewWrapper.lastId = 0;
        anywheresoftware.b4a.keywords.Common.Log("** Activity (main) Create, isFirst = " + isFirst + " **");
        processBA.raiseEvent2(null, true, "activity_create", false, isFirst);
		isFirst = false;
		if (mostCurrent == null || mostCurrent != this)
			return;
        processBA.setActivityPaused(false);
        anywheresoftware.b4a.keywords.Common.Log("** Activity (main) Resume **");
        processBA.raiseEvent(null, "activity_resume");

	}
	public void addMenuItem(B4AMenuItem item) {
		if (menuItems == null)
			menuItems = new java.util.ArrayList<B4AMenuItem>();
		menuItems.add(item);
	}
	@Override
	public boolean onCreateOptionsMenu(android.view.Menu menu) {
		super.onCreateOptionsMenu(menu);
		if (menuItems == null)
			return false;
		for (B4AMenuItem bmi : menuItems) {
			android.view.MenuItem mi = menu.add(bmi.title);
			if (bmi.drawable != null)
				mi.setIcon(bmi.drawable);
			mi.setOnMenuItemClickListener(new B4AMenuItemsClickListener(bmi.eventName.toLowerCase(BA.cul)));
		}
		return true;
	}
	private class B4AMenuItemsClickListener implements android.view.MenuItem.OnMenuItemClickListener {
		private final String eventName;
		public B4AMenuItemsClickListener(String eventName) {
			this.eventName = eventName;
		}
		public boolean onMenuItemClick(android.view.MenuItem item) {
			processBA.raiseEvent(item.getTitle(), eventName + "_click");
			return true;
		}
	}
    public static Class<?> getObject() {
		return main.class;
	}
    private Boolean onKeySubExist = null;
    private Boolean onKeyUpSubExist = null;
	@Override
	public boolean onKeyDown(int keyCode, android.view.KeyEvent event) {
		if (onKeySubExist == null)
			onKeySubExist = processBA.subExists("activity_keypress");
		if (onKeySubExist) {
			Boolean res =  (Boolean)processBA.raiseEvent2(_activity, false, "activity_keypress", false, keyCode);
			if (res == null || res == true)
				return true;
		}
		return super.onKeyDown(keyCode, event);
	}
    @Override
	public boolean onKeyUp(int keyCode, android.view.KeyEvent event) {
		if (onKeyUpSubExist == null)
			onKeyUpSubExist = processBA.subExists("activity_keyup");
		if (onKeyUpSubExist) {
			Boolean res =  (Boolean)processBA.raiseEvent2(_activity, false, "activity_keyup", false, keyCode);
			if (res == null || res == true)
				return true;
		}
		return super.onKeyUp(keyCode, event);
	}
	@Override
	public void onNewIntent(android.content.Intent intent) {
		this.setIntent(intent);
	}
    @Override 
	public void onPause() {
		super.onPause();
        if (_activity == null) //workaround for emulator bug (Issue 2423)
            return;
		anywheresoftware.b4a.Msgbox.dismiss(true);
        anywheresoftware.b4a.keywords.Common.Log("** Activity (main) Pause, UserClosed = " + activityBA.activity.isFinishing() + " **");
        processBA.raiseEvent2(_activity, true, "activity_pause", false, activityBA.activity.isFinishing());		
        processBA.setActivityPaused(true);
        mostCurrent = null;
        if (!activityBA.activity.isFinishing())
			previousOne = new WeakReference<Activity>(this);
        anywheresoftware.b4a.Msgbox.isDismissing = false;
	}

	@Override
	public void onDestroy() {
        super.onDestroy();
		previousOne = null;
	}
    @Override 
	public void onResume() {
		super.onResume();
        mostCurrent = this;
        anywheresoftware.b4a.Msgbox.isDismissing = false;
        if (activityBA != null) { //will be null during activity create (which waits for AfterLayout).
        	ResumeMessage rm = new ResumeMessage(mostCurrent);
        	BA.handler.post(rm);
        }
	}
    private static class ResumeMessage implements Runnable {
    	private final WeakReference<Activity> activity;
    	public ResumeMessage(Activity activity) {
    		this.activity = new WeakReference<Activity>(activity);
    	}
		public void run() {
			if (mostCurrent == null || mostCurrent != activity.get())
				return;
			processBA.setActivityPaused(false);
            anywheresoftware.b4a.keywords.Common.Log("** Activity (main) Resume **");
		    processBA.raiseEvent(mostCurrent._activity, "activity_resume", (Object[])null);
		}
    }
	@Override
	protected void onActivityResult(int requestCode, int resultCode,
	      android.content.Intent data) {
		processBA.onActivityResult(requestCode, resultCode, data);
	}
	private static void initializeGlobals() {
		processBA.raiseEvent2(null, true, "globals", false, (Object[])null);
	}

public static class _rowcol{
boolean IsInitialized;
int Row;
int Col;
public void Initialize() {
IsInitialized = true;
Row = 0;
Col = 0;
}
@Override
		public String toString() {
			return BA.TypeToString(this);
		}}
public static class _nameandmac{
boolean IsInitialized;
String Name;
String Mac;
public void Initialize() {
IsInitialized = true;
Name = "";
Mac = "";
}
@Override
		public String toString() {
			return BA.TypeToString(this);
		}}
public anywheresoftware.b4a.keywords.Common __c = null;
public static anywheresoftware.b4a.objects.Serial.BluetoothAdmin _admin = null;
public static anywheresoftware.b4a.objects.Serial _serial1 = null;
public static anywheresoftware.b4a.objects.streams.File.TextReaderWrapper _textreader1 = null;
public static anywheresoftware.b4a.objects.streams.File.TextWriterWrapper _textwriter1 = null;
public static anywheresoftware.b4a.objects.Timer _timer1 = null;
public static boolean _connected = false;
public static char[] _buffer = null;
public static anywheresoftware.b4a.agraham.byteconverter.ByteConverter _converter = null;
public static anywheresoftware.b4a.objects.collections.List _founddevices = null;
public static main._nameandmac _connecteddevice = null;
public static int _last_buffer_size = 0;
public static boolean _return_from_cli = false;
public static anywheresoftware.b4a.objects.Timer _tmranimation = null;
public static int _currentpanelbeforepaused = 0;
public static String _connected_device = "";
public static int _protocol = 0;
public static int _currenttab = 0;
public static String _msp_ident = "";
public static String _msp_status = "";
public static String _msp_raw_imu = "";
public static String _msp_servo = "";
public static String _msp_motor = "";
public static String _msp_rc = "";
public static String _msp_raw_gps = "";
public static String _msp_comp_gps = "";
public static String _msp_attitude = "";
public static String _msp_altitude = "";
public static String _msp_bat = "";
public static String _msp_rc_tuning = "";
public static String _msp_pid = "";
public static String _msp_box = "";
public static String _msp_misc = "";
public static String _msp_set_raw_rc = "";
public static String _msp_set_raw_gps = "";
public static String _msp_set_pid = "";
public static String _msp_set_box = "";
public static String _msp_set_rc_tuning = "";
public static String _msp_acc_calibration = "";
public static String _msp_mag_calibration = "";
public static String _msp_set_misc = "";
public static String _msp_reset_conf = "";
public static String _msp_eeprom_write = "";
public static String _msp_debug = "";
public static int _statemsp = 0;
public static int _offset = 0;
public static int _datasize = 0;
public static int _indtx = 0;
public static byte _checksum = 0;
public anywheresoftware.b4a.objects.TabHostWrapper _main_tabhost1 = null;
public uk.co.martinpearman.b4a.tabhostextras.TabHostExtras _tabmanager = null;
public anywheresoftware.b4a.objects.SeekBarWrapper _sk1 = null;
public anywheresoftware.b4a.agraham.dialogs.InputDialog.CustomDialog _cd = null;
public anywheresoftware.b4a.objects.LabelWrapper _lbl2 = null;
public anywheresoftware.b4a.objects.EditTextWrapper _txtbox = null;
public anywheresoftware.b4a.objects.LabelWrapper _connected_label = null;
public static int _valor = 0;
public anywheresoftware.b4a.objects.ScrollViewWrapper _sv = null;
public anywheresoftware.b4a.objects.PanelWrapper _header = null;
public anywheresoftware.b4a.objects.PanelWrapper _table = null;
public anywheresoftware.b4a.objects.PanelWrapper _main_tabhost1_panel = null;
public static int _numberofcolumns = 0;
public static int _rowheight = 0;
public static int _rowheight_1 = 0;
public static int _columnwidth = 0;
public static int _columnwidth_1 = 0;
public static int _headercolor = 0;
public static int _linecolor = 0;
public static int _cellcolor = 0;
public static int _fontcolor = 0;
public static int _headerfontcolor = 0;
public static float _fontsize = 0f;
public static int _alignment = 0;
public static int _selectedrow = 0;
public static int _selectedrowcolor = 0;
public static int[] _selectedcell = null;
public static int _collinewidth = 0;
public static int _rowlinewidth = 0;
public static int _checkboxitems = 0;
public static int _piditems = 0;
public static int _commlistmax = 0;
public static int _frame_size_read = 0;
public static int _frame_size_write = 0;
public static int[] _bytep = null;
public static int[] _bytei = null;
public static int[] _byted = null;
public static int _what_col = 0;
public static boolean[] _checkeado = null;
public static int _gps_distancetohome = 0;
public static int _gps_directiontohome = 0;
public static int _gps_numsat = 0;
public static int _gps_fix = 0;
public static int _gps_update = 0;
public static int _pmetersum = 0;
public static int _intpowertrigger = 0;
public static int _bytevbat = 0;
public anywheresoftware.b4a.objects.PanelWrapper _radio_panel = null;
public anywheresoftware.b4a.objects.LabelWrapper _rollpitchrate = null;
public anywheresoftware.b4a.objects.LabelWrapper _yawrate = null;
public anywheresoftware.b4a.objects.LabelWrapper _throttlepidatt = null;
public anywheresoftware.b4a.objects.LabelWrapper _rcexpo = null;
public anywheresoftware.b4a.objects.LabelWrapper _rcrate = null;
public anywheresoftware.b4a.objects.LabelWrapper _throttleexpo = null;
public anywheresoftware.b4a.objects.LabelWrapper _throttlemid = null;
public anywheresoftware.b4a.objects.LabelWrapper[] _labelsrc = null;
public static String[] _labelstext = null;
public anywheresoftware.b4a.objects.ProgressBarWrapper[] _radios = null;
public anywheresoftware.b4a.objects.ProgressBarWrapper[] _motors = null;
public anywheresoftware.b4a.objects.ButtonWrapper _start_rc = null;
public anywheresoftware.b4a.objects.ButtonWrapper _start_motors = null;
public static boolean _rc_reading = false;
public static boolean _gps_reading = false;
public static boolean _motors_reading = false;
public slidingpanels._slidingdata _sdi = null;
public static int _slidingduration = 0;
public anywheresoftware.b4a.objects.LabelWrapper[] _label_rcdata = null;
public anywheresoftware.b4a.objects.LabelWrapper[] _label_motordata = null;
public static float _startx = 0f;
public static float _starty = 0f;
public anywheresoftware.b4a.objects.ButtonWrapper _read = null;
public anywheresoftware.b4a.objects.ButtonWrapper _write = null;
public anywheresoftware.b4a.objects.HorizontalScrollViewWrapper _switchspanel = null;
public anywheresoftware.b4a.objects.LabelWrapper[] _switchlabel = null;
public anywheresoftware.b4a.objects.PanelWrapper _panellabel = null;
public anywheresoftware.b4a.objects.HorizontalScrollViewWrapper _panelswitch = null;
public anywheresoftware.b4a.objects.CompoundButtonWrapper.CheckBoxWrapper[][] _checkbox_switch = null;
public anywheresoftware.b4a.objects.LabelWrapper _gps_alt = null;
public anywheresoftware.b4a.objects.LabelWrapper _gps_lat = null;
public anywheresoftware.b4a.objects.LabelWrapper _gps_lon = null;
public anywheresoftware.b4a.objects.LabelWrapper _gps_speed = null;
public anywheresoftware.b4a.objects.LabelWrapper _gpsfix = null;
public anywheresoftware.b4a.objects.LabelWrapper _gpsnumsat = null;
public anywheresoftware.b4a.objects.LabelWrapper _googlemaps_button = null;
public cli _cli = null;
public slidingpanels _slidingpanels = null;
public oscilo _oscilo = null;
public static String  _activity_create(boolean _firsttime) throws Exception{
anywheresoftware.b4a.objects.PanelWrapper _radiopanel = null;
anywheresoftware.b4a.objects.PanelWrapper[] _panels = null;
anywheresoftware.b4a.objects.LabelWrapper _label_text = null;
anywheresoftware.b4a.objects.LabelWrapper[] _rclabel = null;
String[] _rclabels = null;
int _i = 0;
String[] _labels = null;
anywheresoftware.b4a.objects.LabelWrapper _labelaux = null;
String _a = "";
int _row = 0;
int _col = 0;
int _iz = 0;
 //BA.debugLineNum = 176;BA.debugLine="Sub Activity_Create(FirstTime As Boolean)";
 //BA.debugLineNum = 177;BA.debugLine="If FirstTime Then";
if (_firsttime) { 
 //BA.debugLineNum = 178;BA.debugLine="admin.Initialize(\"admin\")";
_admin.Initialize(processBA,"admin");
 //BA.debugLineNum = 179;BA.debugLine="serial1.Initialize(\"serial1\")";
_serial1.Initialize("serial1");
 //BA.debugLineNum = 180;BA.debugLine="Timer1.Initialize(\"Timer1\", 200)";
_timer1.Initialize(processBA,"Timer1",(long)(200));
 //BA.debugLineNum = 181;BA.debugLine="return_from_cli=False";
_return_from_cli = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 182;BA.debugLine="rc_reading=False";
_rc_reading = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 183;BA.debugLine="protocol=1  '0= old protocol 1= new protocol";
_protocol = (int)(1);
 //BA.debugLineNum = 184;BA.debugLine="CurrentTab=0";
_currenttab = (int)(0);
 };
 //BA.debugLineNum = 187;BA.debugLine="Activity.LoadLayout(\"main_main\")";
mostCurrent._activity.LoadLayout("main_main",mostCurrent.activityBA);
 //BA.debugLineNum = 190;BA.debugLine="Activity.AddMenuItem(\"Calibrate Acc\",\"calacc\")";
mostCurrent._activity.AddMenuItem("Calibrate Acc","calacc");
 //BA.debugLineNum = 191;BA.debugLine="Activity.AddMenuItem(\"Calibrate Mag\",\"calmag\")";
mostCurrent._activity.AddMenuItem("Calibrate Mag","calmag");
 //BA.debugLineNum = 192;BA.debugLine="Activity.AddMenuItem(\"Cli Settings\",\"cli_settings\")";
mostCurrent._activity.AddMenuItem("Cli Settings","cli_settings");
 //BA.debugLineNum = 193;BA.debugLine="Activity.AddMenuItem(\"Realtime Graphs\",\"realtime\")";
mostCurrent._activity.AddMenuItem("Realtime Graphs","realtime");
 //BA.debugLineNum = 194;BA.debugLine="Activity.AddMenuItem(\"Save Data\",\"savedata\")";
mostCurrent._activity.AddMenuItem("Save Data","savedata");
 //BA.debugLineNum = 195;BA.debugLine="Activity.AddMenuItem(\"Read Data\",\"readdata\")";
mostCurrent._activity.AddMenuItem("Read Data","readdata");
 //BA.debugLineNum = 196;BA.debugLine="Activity.AddMenuItem(\"Protocol\",\"chooseprotocol\")";
mostCurrent._activity.AddMenuItem("Protocol","chooseprotocol");
 //BA.debugLineNum = 197;BA.debugLine="main_TabHost1_Panel.Initialize(\"\")";
mostCurrent._main_tabhost1_panel.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 198;BA.debugLine="main_TabHost1_Panel.LoadLayout(\"table_one\")";
mostCurrent._main_tabhost1_panel.LoadLayout("table_one",mostCurrent.activityBA);
 //BA.debugLineNum = 199;BA.debugLine="main_TabHost1.Height=98%y";
mostCurrent._main_tabhost1.setHeight(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(98),mostCurrent.activityBA));
 //BA.debugLineNum = 200;BA.debugLine="tableaaa";
_tableaaa();
 //BA.debugLineNum = 201;BA.debugLine="main_TabHost1.AddTab2(\"PID\",main_TabHost1_Panel)";
mostCurrent._main_tabhost1.AddTab2("PID",(android.view.View)(mostCurrent._main_tabhost1_panel.getObject()));
 //BA.debugLineNum = 206;BA.debugLine="Dim radiopanel As Panel";
_radiopanel = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 207;BA.debugLine="radiopanel.Initialize(\"\")";
_radiopanel.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 209;BA.debugLine="Dim panels(4) As Panel";
_panels = new anywheresoftware.b4a.objects.PanelWrapper[(int)(4)];
{
int d0 = _panels.length;
for (int i0 = 0;i0 < d0;i0++) {
_panels[i0] = new anywheresoftware.b4a.objects.PanelWrapper();
}
}
;
 //BA.debugLineNum = 210;BA.debugLine="panels(0).Initialize(\"panels\")";
_panels[(int)(0)].Initialize(mostCurrent.activityBA,"panels");
 //BA.debugLineNum = 211;BA.debugLine="panels(1).Initialize(\"panels\")";
_panels[(int)(1)].Initialize(mostCurrent.activityBA,"panels");
 //BA.debugLineNum = 212;BA.debugLine="panels(2).Initialize(\"panels\")";
_panels[(int)(2)].Initialize(mostCurrent.activityBA,"panels");
 //BA.debugLineNum = 213;BA.debugLine="panels(3).Initialize(\"panels\")";
_panels[(int)(3)].Initialize(mostCurrent.activityBA,"panels");
 //BA.debugLineNum = 216;BA.debugLine="Dim label_text As Label";
_label_text = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 217;BA.debugLine="Dim rclabel(7) As Label";
_rclabel = new anywheresoftware.b4a.objects.LabelWrapper[(int)(7)];
{
int d0 = _rclabel.length;
for (int i0 = 0;i0 < d0;i0++) {
_rclabel[i0] = new anywheresoftware.b4a.objects.LabelWrapper();
}
}
;
 //BA.debugLineNum = 218;BA.debugLine="Dim rclabels(7) As String";
_rclabels = new String[(int)(7)];
java.util.Arrays.fill(_rclabels,"");
 //BA.debugLineNum = 219;BA.debugLine="rclabels=Array As String (\"Roll/Pitch Rate\",\"Yaw Rate\",\"Throttle PID att\",\"RC expo\",\"RC Rate\",\"ThrottleMid\",\"ThrottleExpo\")";
_rclabels = new String[]{"Roll/Pitch Rate","Yaw Rate","Throttle PID att","RC expo","RC Rate","ThrottleMid","ThrottleExpo"};
 //BA.debugLineNum = 220;BA.debugLine="For i=0 To rclabel.Length - 1";
{
final double step177 = 1;
final double limit177 = (int)(_rclabel.length-1);
for (_i = (int)(0); (step177 > 0 && _i <= limit177) || (step177 < 0 && _i >= limit177); _i += step177) {
 //BA.debugLineNum = 221;BA.debugLine="rclabel(i).Initialize(\"\")";
_rclabel[_i].Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 222;BA.debugLine="panels(0).AddView(rclabel(i),0,0,0,30dip)";
_panels[(int)(0)].AddView((android.view.View)(_rclabel[_i].getObject()),(int)(0),(int)(0),(int)(0),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 223;BA.debugLine="rclabel(i).Width=100dip";
_rclabel[_i].setWidth(anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(100)));
 //BA.debugLineNum = 224;BA.debugLine="rclabel(i).Top=10%y*(i+1)";
_rclabel[_i].setTop((int)(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(10),mostCurrent.activityBA)*(_i+1)));
 //BA.debugLineNum = 225;BA.debugLine="rclabel(i).Left=45%x-rclabel(i).Width";
_rclabel[_i].setLeft((int)(anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(45),mostCurrent.activityBA)-_rclabel[_i].getWidth()));
 //BA.debugLineNum = 226;BA.debugLine="rclabel(i).Text=rclabels(i)";
_rclabel[_i].setText((Object)(_rclabels[_i]));
 }
};
 //BA.debugLineNum = 229;BA.debugLine="RollPitchRate.Initialize(\"rollpitchrate\")";
mostCurrent._rollpitchrate.Initialize(mostCurrent.activityBA,"rollpitchrate");
 //BA.debugLineNum = 230;BA.debugLine="YawRate.Initialize(\"yawrate\")";
mostCurrent._yawrate.Initialize(mostCurrent.activityBA,"yawrate");
 //BA.debugLineNum = 231;BA.debugLine="ThrottlePidAtt.Initialize(\"throttlepidatt\")";
mostCurrent._throttlepidatt.Initialize(mostCurrent.activityBA,"throttlepidatt");
 //BA.debugLineNum = 232;BA.debugLine="rcexpo.Initialize(\"rcexpo\")";
mostCurrent._rcexpo.Initialize(mostCurrent.activityBA,"rcexpo");
 //BA.debugLineNum = 233;BA.debugLine="rcrate.Initialize(\"rcrate\")";
mostCurrent._rcrate.Initialize(mostCurrent.activityBA,"rcrate");
 //BA.debugLineNum = 234;BA.debugLine="throttleMid.Initialize(\"throttlemid\")";
mostCurrent._throttlemid.Initialize(mostCurrent.activityBA,"throttlemid");
 //BA.debugLineNum = 235;BA.debugLine="throttleExpo.Initialize(\"throttleexpo\")";
mostCurrent._throttleexpo.Initialize(mostCurrent.activityBA,"throttleexpo");
 //BA.debugLineNum = 237;BA.debugLine="panels(0).AddView(RollPitchRate,0,0,50dip,30dip)";
_panels[(int)(0)].AddView((android.view.View)(mostCurrent._rollpitchrate.getObject()),(int)(0),(int)(0),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(50)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 238;BA.debugLine="panels(0).AddView(YawRate,0,0,50dip,30dip)";
_panels[(int)(0)].AddView((android.view.View)(mostCurrent._yawrate.getObject()),(int)(0),(int)(0),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(50)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 239;BA.debugLine="panels(0).AddView(ThrottlePidAtt,0,0,50dip,30dip)";
_panels[(int)(0)].AddView((android.view.View)(mostCurrent._throttlepidatt.getObject()),(int)(0),(int)(0),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(50)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 240;BA.debugLine="panels(0).AddView(rcexpo,0,0,50dip,30dip)";
_panels[(int)(0)].AddView((android.view.View)(mostCurrent._rcexpo.getObject()),(int)(0),(int)(0),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(50)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 241;BA.debugLine="panels(0).AddView(rcrate,0,0,50dip,30dip)";
_panels[(int)(0)].AddView((android.view.View)(mostCurrent._rcrate.getObject()),(int)(0),(int)(0),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(50)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 242;BA.debugLine="panels(0).AddView(throttleMid,0,0,50dip,30dip)";
_panels[(int)(0)].AddView((android.view.View)(mostCurrent._throttlemid.getObject()),(int)(0),(int)(0),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(50)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 243;BA.debugLine="panels(0).AddView(throttleExpo,0,0,50dip,30dip)";
_panels[(int)(0)].AddView((android.view.View)(mostCurrent._throttleexpo.getObject()),(int)(0),(int)(0),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(50)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 246;BA.debugLine="RollPitchRate.Top=10%y";
mostCurrent._rollpitchrate.setTop(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(10),mostCurrent.activityBA));
 //BA.debugLineNum = 247;BA.debugLine="YawRate.Top=20%y";
mostCurrent._yawrate.setTop(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(20),mostCurrent.activityBA));
 //BA.debugLineNum = 248;BA.debugLine="ThrottlePidAtt.Top=30%y";
mostCurrent._throttlepidatt.setTop(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(30),mostCurrent.activityBA));
 //BA.debugLineNum = 249;BA.debugLine="rcexpo.Top=40%y";
mostCurrent._rcexpo.setTop(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(40),mostCurrent.activityBA));
 //BA.debugLineNum = 250;BA.debugLine="rcrate.Top=50%y";
mostCurrent._rcrate.setTop(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(50),mostCurrent.activityBA));
 //BA.debugLineNum = 251;BA.debugLine="throttleMid.Top=60%y";
mostCurrent._throttlemid.setTop(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(60),mostCurrent.activityBA));
 //BA.debugLineNum = 252;BA.debugLine="throttleExpo.Top=70%y";
mostCurrent._throttleexpo.setTop(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(70),mostCurrent.activityBA));
 //BA.debugLineNum = 254;BA.debugLine="RollPitchRate.left=55%x";
mostCurrent._rollpitchrate.setLeft(anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(55),mostCurrent.activityBA));
 //BA.debugLineNum = 255;BA.debugLine="YawRate.left=55%x";
mostCurrent._yawrate.setLeft(anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(55),mostCurrent.activityBA));
 //BA.debugLineNum = 256;BA.debugLine="ThrottlePidAtt.left=55%x";
mostCurrent._throttlepidatt.setLeft(anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(55),mostCurrent.activityBA));
 //BA.debugLineNum = 257;BA.debugLine="rcexpo.left=55%x";
mostCurrent._rcexpo.setLeft(anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(55),mostCurrent.activityBA));
 //BA.debugLineNum = 258;BA.debugLine="rcrate.left=55%x";
mostCurrent._rcrate.setLeft(anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(55),mostCurrent.activityBA));
 //BA.debugLineNum = 259;BA.debugLine="throttleMid.left=55%x";
mostCurrent._throttlemid.setLeft(anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(55),mostCurrent.activityBA));
 //BA.debugLineNum = 260;BA.debugLine="throttleExpo.left=55%x";
mostCurrent._throttleexpo.setLeft(anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(55),mostCurrent.activityBA));
 //BA.debugLineNum = 263;BA.debugLine="RollPitchRate.Color=Colors.ARGB(255,255,255,255)";
mostCurrent._rollpitchrate.setColor(anywheresoftware.b4a.keywords.Common.Colors.ARGB((int)(255),(int)(255),(int)(255),(int)(255)));
 //BA.debugLineNum = 264;BA.debugLine="YawRate.Color=Colors.ARGB(255,255,255,255)";
mostCurrent._yawrate.setColor(anywheresoftware.b4a.keywords.Common.Colors.ARGB((int)(255),(int)(255),(int)(255),(int)(255)));
 //BA.debugLineNum = 265;BA.debugLine="ThrottlePidAtt.Color=Colors.ARGB(255,255,255,255)";
mostCurrent._throttlepidatt.setColor(anywheresoftware.b4a.keywords.Common.Colors.ARGB((int)(255),(int)(255),(int)(255),(int)(255)));
 //BA.debugLineNum = 266;BA.debugLine="rcexpo.Color=Colors.ARGB(255,255,255,255)";
mostCurrent._rcexpo.setColor(anywheresoftware.b4a.keywords.Common.Colors.ARGB((int)(255),(int)(255),(int)(255),(int)(255)));
 //BA.debugLineNum = 267;BA.debugLine="rcrate.Color=Colors.ARGB(255,255,255,255)";
mostCurrent._rcrate.setColor(anywheresoftware.b4a.keywords.Common.Colors.ARGB((int)(255),(int)(255),(int)(255),(int)(255)));
 //BA.debugLineNum = 268;BA.debugLine="throttleMid.Color=Colors.ARGB(255,255,255,255)";
mostCurrent._throttlemid.setColor(anywheresoftware.b4a.keywords.Common.Colors.ARGB((int)(255),(int)(255),(int)(255),(int)(255)));
 //BA.debugLineNum = 269;BA.debugLine="throttleExpo.Color=Colors.ARGB(255,255,255,255)";
mostCurrent._throttleexpo.setColor(anywheresoftware.b4a.keywords.Common.Colors.ARGB((int)(255),(int)(255),(int)(255),(int)(255)));
 //BA.debugLineNum = 271;BA.debugLine="RollPitchRate.Text=\"0.0\"";
mostCurrent._rollpitchrate.setText((Object)("0.0"));
 //BA.debugLineNum = 272;BA.debugLine="YawRate.Text=\"0.0\"";
mostCurrent._yawrate.setText((Object)("0.0"));
 //BA.debugLineNum = 273;BA.debugLine="ThrottlePidAtt.Text=\"0.0\"";
mostCurrent._throttlepidatt.setText((Object)("0.0"));
 //BA.debugLineNum = 274;BA.debugLine="rcexpo.Text=\"0.0\"";
mostCurrent._rcexpo.setText((Object)("0.0"));
 //BA.debugLineNum = 275;BA.debugLine="rcrate.Text=\"0.0\"";
mostCurrent._rcrate.setText((Object)("0.0"));
 //BA.debugLineNum = 276;BA.debugLine="throttleMid.Text=\"0.0\"";
mostCurrent._throttlemid.setText((Object)("0.0"));
 //BA.debugLineNum = 277;BA.debugLine="throttleExpo.Text=\"0.0\"";
mostCurrent._throttleexpo.setText((Object)("0.0"));
 //BA.debugLineNum = 279;BA.debugLine="RollPitchRate.TextColor=Colors.Black";
mostCurrent._rollpitchrate.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Black);
 //BA.debugLineNum = 280;BA.debugLine="YawRate.TextColor=Colors.Black";
mostCurrent._yawrate.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Black);
 //BA.debugLineNum = 281;BA.debugLine="ThrottlePidAtt.TextColor=Colors.Black";
mostCurrent._throttlepidatt.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Black);
 //BA.debugLineNum = 282;BA.debugLine="rcexpo.TextColor=Colors.Black";
mostCurrent._rcexpo.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Black);
 //BA.debugLineNum = 283;BA.debugLine="rcrate.TextColor=Colors.Black";
mostCurrent._rcrate.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Black);
 //BA.debugLineNum = 284;BA.debugLine="throttleMid.TextColor=Colors.Black";
mostCurrent._throttlemid.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Black);
 //BA.debugLineNum = 285;BA.debugLine="throttleExpo.TextColor=Colors.Black";
mostCurrent._throttleexpo.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Black);
 //BA.debugLineNum = 287;BA.debugLine="RollPitchRate.Gravity=Gravity.CENTER";
mostCurrent._rollpitchrate.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 288;BA.debugLine="YawRate.Gravity=Gravity.CENTER";
mostCurrent._yawrate.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 289;BA.debugLine="ThrottlePidAtt.Gravity=Gravity.CENTER";
mostCurrent._throttlepidatt.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 290;BA.debugLine="rcexpo.Gravity=Gravity.CENTER";
mostCurrent._rcexpo.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 291;BA.debugLine="rcrate.Gravity=Gravity.CENTER";
mostCurrent._rcrate.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 292;BA.debugLine="throttleMid.Gravity=Gravity.CENTER";
mostCurrent._throttlemid.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 293;BA.debugLine="throttleExpo.Gravity=Gravity.CENTER";
mostCurrent._throttleexpo.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 295;BA.debugLine="RollPitchRate.Enabled=True";
mostCurrent._rollpitchrate.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 296;BA.debugLine="YawRate.Enabled=True";
mostCurrent._yawrate.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 297;BA.debugLine="ThrottlePidAtt.Enabled=True";
mostCurrent._throttlepidatt.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 298;BA.debugLine="rcexpo.Enabled=True";
mostCurrent._rcexpo.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 299;BA.debugLine="rcrate.Enabled=True";
mostCurrent._rcrate.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 300;BA.debugLine="throttleMid.Enabled=True";
mostCurrent._throttlemid.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 301;BA.debugLine="throttleExpo.Enabled=True";
mostCurrent._throttleexpo.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 305;BA.debugLine="For i=0 To radios.Length-1";
{
final double step248 = 1;
final double limit248 = (int)(mostCurrent._radios.length-1);
for (_i = (int)(0); (step248 > 0 && _i <= limit248) || (step248 < 0 && _i >= limit248); _i += step248) {
 //BA.debugLineNum = 306;BA.debugLine="labelsrc(i).initialize(\"\")";
mostCurrent._labelsrc[_i].Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 307;BA.debugLine="panels(1).AddView(labelsrc(i),0,0,0,0)";
_panels[(int)(1)].AddView((android.view.View)(mostCurrent._labelsrc[_i].getObject()),(int)(0),(int)(0),(int)(0),(int)(0));
 //BA.debugLineNum = 308;BA.debugLine="labelsrc(i).Left=0%x";
mostCurrent._labelsrc[_i].setLeft(anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(0),mostCurrent.activityBA));
 //BA.debugLineNum = 309;BA.debugLine="labelsrc(i).Top=5%y+i*8%y";
mostCurrent._labelsrc[_i].setTop((int)(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(5),mostCurrent.activityBA)+_i*anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(8),mostCurrent.activityBA)));
 //BA.debugLineNum = 310;BA.debugLine="labelsrc(i).Width=50dip";
mostCurrent._labelsrc[_i].setWidth(anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(50)));
 //BA.debugLineNum = 311;BA.debugLine="labelsrc(i).Height=30dip";
mostCurrent._labelsrc[_i].setHeight(anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 312;BA.debugLine="labelsrc(i).text=labelsText(i)";
mostCurrent._labelsrc[_i].setText((Object)(mostCurrent._labelstext[_i]));
 //BA.debugLineNum = 313;BA.debugLine="radios(i).Initialize(\"\")";
mostCurrent._radios[_i].Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 314;BA.debugLine="panels(1).AddView(radios(i),0,0,0,0)";
_panels[(int)(1)].AddView((android.view.View)(mostCurrent._radios[_i].getObject()),(int)(0),(int)(0),(int)(0),(int)(0));
 //BA.debugLineNum = 315;BA.debugLine="radios(i).Left=labelsrc(i).width+5%x";
mostCurrent._radios[_i].setLeft((int)(mostCurrent._labelsrc[_i].getWidth()+anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(5),mostCurrent.activityBA)));
 //BA.debugLineNum = 316;BA.debugLine="radios(i).Top=5%y+i*8%y";
mostCurrent._radios[_i].setTop((int)(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(5),mostCurrent.activityBA)+_i*anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(8),mostCurrent.activityBA)));
 //BA.debugLineNum = 317;BA.debugLine="radios(i).Width=50%x";
mostCurrent._radios[_i].setWidth(anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(50),mostCurrent.activityBA));
 //BA.debugLineNum = 318;BA.debugLine="radios(i).Height=20dip";
mostCurrent._radios[_i].setHeight(anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(20)));
 //BA.debugLineNum = 319;BA.debugLine="label_rcdata(i).Initialize(\"\")";
mostCurrent._label_rcdata[_i].Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 320;BA.debugLine="panels(1).AddView(label_rcdata(i),0,0,0,0)";
_panels[(int)(1)].AddView((android.view.View)(mostCurrent._label_rcdata[_i].getObject()),(int)(0),(int)(0),(int)(0),(int)(0));
 //BA.debugLineNum = 321;BA.debugLine="label_rcdata(i).Left=labelsrc(i).width+5%x+radios(i).Width+5%x";
mostCurrent._label_rcdata[_i].setLeft((int)(mostCurrent._labelsrc[_i].getWidth()+anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(5),mostCurrent.activityBA)+mostCurrent._radios[_i].getWidth()+anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(5),mostCurrent.activityBA)));
 //BA.debugLineNum = 322;BA.debugLine="label_rcdata(i).Top=5%y+i*8%y";
mostCurrent._label_rcdata[_i].setTop((int)(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(5),mostCurrent.activityBA)+_i*anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(8),mostCurrent.activityBA)));
 //BA.debugLineNum = 323;BA.debugLine="label_rcdata(i).Width=50dip";
mostCurrent._label_rcdata[_i].setWidth(anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(50)));
 //BA.debugLineNum = 324;BA.debugLine="label_rcdata(i).Height=30dip";
mostCurrent._label_rcdata[_i].setHeight(anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 325;BA.debugLine="label_rcdata(i).Gravity=Gravity.CENTER";
mostCurrent._label_rcdata[_i].setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 }
};
 //BA.debugLineNum = 329;BA.debugLine="For i=0 To motors.Length-1";
{
final double step270 = 1;
final double limit270 = (int)(mostCurrent._motors.length-1);
for (_i = (int)(0); (step270 > 0 && _i <= limit270) || (step270 < 0 && _i >= limit270); _i += step270) {
 //BA.debugLineNum = 330;BA.debugLine="labelsrc(i).initialize(\"\")";
mostCurrent._labelsrc[_i].Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 331;BA.debugLine="panels(2).AddView(labelsrc(i),0,0,0,0)";
_panels[(int)(2)].AddView((android.view.View)(mostCurrent._labelsrc[_i].getObject()),(int)(0),(int)(0),(int)(0),(int)(0));
 //BA.debugLineNum = 332;BA.debugLine="labelsrc(i).Left=0%x";
mostCurrent._labelsrc[_i].setLeft(anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(0),mostCurrent.activityBA));
 //BA.debugLineNum = 333;BA.debugLine="labelsrc(i).Top=5%y+i*8%y";
mostCurrent._labelsrc[_i].setTop((int)(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(5),mostCurrent.activityBA)+_i*anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(8),mostCurrent.activityBA)));
 //BA.debugLineNum = 334;BA.debugLine="labelsrc(i).Width=80dip";
mostCurrent._labelsrc[_i].setWidth(anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(80)));
 //BA.debugLineNum = 335;BA.debugLine="labelsrc(i).Height=30dip";
mostCurrent._labelsrc[_i].setHeight(anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 336;BA.debugLine="labelsrc(i).text=\"motor \" & (i+1)";
mostCurrent._labelsrc[_i].setText((Object)("motor "+BA.NumberToString((_i+1))));
 //BA.debugLineNum = 337;BA.debugLine="motors(i).Initialize(\"\")";
mostCurrent._motors[_i].Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 338;BA.debugLine="panels(2).AddView(motors(i),0,0,0,0)";
_panels[(int)(2)].AddView((android.view.View)(mostCurrent._motors[_i].getObject()),(int)(0),(int)(0),(int)(0),(int)(0));
 //BA.debugLineNum = 339;BA.debugLine="motors(i).Left=labelsrc(i).width+3%x";
mostCurrent._motors[_i].setLeft((int)(mostCurrent._labelsrc[_i].getWidth()+anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(3),mostCurrent.activityBA)));
 //BA.debugLineNum = 340;BA.debugLine="motors(i).Top=5%y+i*8%y";
mostCurrent._motors[_i].setTop((int)(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(5),mostCurrent.activityBA)+_i*anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(8),mostCurrent.activityBA)));
 //BA.debugLineNum = 341;BA.debugLine="motors(i).Width=40%x";
mostCurrent._motors[_i].setWidth(anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(40),mostCurrent.activityBA));
 //BA.debugLineNum = 342;BA.debugLine="motors(i).Height=20dip";
mostCurrent._motors[_i].setHeight(anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(20)));
 //BA.debugLineNum = 343;BA.debugLine="label_motordata(i).Initialize(\"\")";
mostCurrent._label_motordata[_i].Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 344;BA.debugLine="panels(2).AddView(label_motordata(i),0,0,0,0)";
_panels[(int)(2)].AddView((android.view.View)(mostCurrent._label_motordata[_i].getObject()),(int)(0),(int)(0),(int)(0),(int)(0));
 //BA.debugLineNum = 345;BA.debugLine="label_motordata(i).Left=labelsrc(i).width+3%x+motors(i).Width+3%x";
mostCurrent._label_motordata[_i].setLeft((int)(mostCurrent._labelsrc[_i].getWidth()+anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(3),mostCurrent.activityBA)+mostCurrent._motors[_i].getWidth()+anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(3),mostCurrent.activityBA)));
 //BA.debugLineNum = 346;BA.debugLine="label_motordata(i).Top=5%y+i*8%y";
mostCurrent._label_motordata[_i].setTop((int)(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(5),mostCurrent.activityBA)+_i*anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(8),mostCurrent.activityBA)));
 //BA.debugLineNum = 347;BA.debugLine="label_motordata(i).Width=50dip";
mostCurrent._label_motordata[_i].setWidth(anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(50)));
 //BA.debugLineNum = 348;BA.debugLine="label_motordata(i).Height=30dip";
mostCurrent._label_motordata[_i].setHeight(anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 349;BA.debugLine="label_motordata(i).Gravity=Gravity.CENTER";
mostCurrent._label_motordata[_i].setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 }
};
 //BA.debugLineNum = 352;BA.debugLine="start_rc.Initialize(\"startrc\")";
mostCurrent._start_rc.Initialize(mostCurrent.activityBA,"startrc");
 //BA.debugLineNum = 353;BA.debugLine="start_rc.Text=\"Start\"";
mostCurrent._start_rc.setText((Object)("Start"));
 //BA.debugLineNum = 354;BA.debugLine="panels(1).AddView(start_rc,50%x,label_rcdata(7).top+label_rcdata(7).Height,60dip,40dip)";
_panels[(int)(1)].AddView((android.view.View)(mostCurrent._start_rc.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(50),mostCurrent.activityBA),(int)(mostCurrent._label_rcdata[(int)(7)].getTop()+mostCurrent._label_rcdata[(int)(7)].getHeight()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(60)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(40)));
 //BA.debugLineNum = 355;BA.debugLine="start_rc.Left=50%x-start_rc.Width/2";
mostCurrent._start_rc.setLeft((int)(anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(50),mostCurrent.activityBA)-mostCurrent._start_rc.getWidth()/(double)2));
 //BA.debugLineNum = 356;BA.debugLine="start_rc.Gravity=Gravity.CENTER";
mostCurrent._start_rc.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 358;BA.debugLine="start_motors.Initialize(\"startmotors\")";
mostCurrent._start_motors.Initialize(mostCurrent.activityBA,"startmotors");
 //BA.debugLineNum = 359;BA.debugLine="start_motors.Text=\"Start\"";
mostCurrent._start_motors.setText((Object)("Start"));
 //BA.debugLineNum = 360;BA.debugLine="panels(2).AddView(start_motors,50%x,label_motordata(7).top+label_motordata(7).Height,60dip,40dip)";
_panels[(int)(2)].AddView((android.view.View)(mostCurrent._start_motors.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(50),mostCurrent.activityBA),(int)(mostCurrent._label_motordata[(int)(7)].getTop()+mostCurrent._label_motordata[(int)(7)].getHeight()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(60)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(40)));
 //BA.debugLineNum = 361;BA.debugLine="start_motors.Left=50%x-start_motors.Width/2";
mostCurrent._start_motors.setLeft((int)(anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(50),mostCurrent.activityBA)-mostCurrent._start_motors.getWidth()/(double)2));
 //BA.debugLineNum = 362;BA.debugLine="start_motors.Gravity=Gravity.CENTER";
mostCurrent._start_motors.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 363;BA.debugLine="gps_alt.Initialize(\"\")";
mostCurrent._gps_alt.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 364;BA.debugLine="gps_lat.Initialize(\"\")";
mostCurrent._gps_lat.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 365;BA.debugLine="gps_lon.Initialize(\"\")";
mostCurrent._gps_lon.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 366;BA.debugLine="gps_speed.Initialize(\"\")";
mostCurrent._gps_speed.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 367;BA.debugLine="gpsfix.Initialize(\"\")";
mostCurrent._gpsfix.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 368;BA.debugLine="gpsnumsat.Initialize(\"\")";
mostCurrent._gpsnumsat.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 369;BA.debugLine="googlemaps_button.Initialize(\"googlemaps_button\")";
mostCurrent._googlemaps_button.Initialize(mostCurrent.activityBA,"googlemaps_button");
 //BA.debugLineNum = 371;BA.debugLine="panels(3).LoadLayout(\"gps\")";
_panels[(int)(3)].LoadLayout("gps",mostCurrent.activityBA);
 //BA.debugLineNum = 377;BA.debugLine="radiopanel.AddView(panels(0), 100%x, 0, 100%x, 100%y - 60dip)";
_radiopanel.AddView((android.view.View)(_panels[(int)(0)].getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(100),mostCurrent.activityBA),(int)(0),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(100),mostCurrent.activityBA),(int)(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(100),mostCurrent.activityBA)-anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(60))));
 //BA.debugLineNum = 378;BA.debugLine="radiopanel.AddView(panels(1), 100%x, 0, 100%x, 100%y - 60dip)";
_radiopanel.AddView((android.view.View)(_panels[(int)(1)].getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(100),mostCurrent.activityBA),(int)(0),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(100),mostCurrent.activityBA),(int)(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(100),mostCurrent.activityBA)-anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(60))));
 //BA.debugLineNum = 379;BA.debugLine="radiopanel.AddView(panels(2), 100%x, 0, 100%x, 100%y - 60dip)";
_radiopanel.AddView((android.view.View)(_panels[(int)(2)].getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(100),mostCurrent.activityBA),(int)(0),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(100),mostCurrent.activityBA),(int)(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(100),mostCurrent.activityBA)-anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(60))));
 //BA.debugLineNum = 380;BA.debugLine="radiopanel.AddView(panels(3), 100%x, 0, 100%x, 100%y - 60dip)";
_radiopanel.AddView((android.view.View)(_panels[(int)(3)].getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(100),mostCurrent.activityBA),(int)(0),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(100),mostCurrent.activityBA),(int)(anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(100),mostCurrent.activityBA)-anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(60))));
 //BA.debugLineNum = 382;BA.debugLine="main_TabHost1.AddTab2(\"Radio\",radiopanel)";
mostCurrent._main_tabhost1.AddTab2("Radio",(android.view.View)(_radiopanel.getObject()));
 //BA.debugLineNum = 387;BA.debugLine="sdi.Initialize";
mostCurrent._sdi.Initialize();
 //BA.debugLineNum = 388;BA.debugLine="sdi.panels = panels";
mostCurrent._sdi.Panels = _panels;
 //BA.debugLineNum = 389;BA.debugLine="SlidingPanels.Initialize(sdi, SlidingDuration)";
mostCurrent._slidingpanels._initialize(mostCurrent.activityBA,mostCurrent._sdi,_slidingduration);
 //BA.debugLineNum = 390;BA.debugLine="sdi.targetPanel = -1";
mostCurrent._sdi.targetPanel = (int)(-1);
 //BA.debugLineNum = 391;BA.debugLine="sdi.currentPanel = currentPanelBeforePaused - 1";
mostCurrent._sdi.currentPanel = (int)(_currentpanelbeforepaused-1);
 //BA.debugLineNum = 392;BA.debugLine="ChangePanel(True) 'Current code expects the first call to be with Left = True.";
_changepanel(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 397;BA.debugLine="Dim labels(11) As String";
_labels = new String[(int)(11)];
java.util.Arrays.fill(_labels,"");
 //BA.debugLineNum = 398;BA.debugLine="labels= Array As String(\"Level\",\"AltHold\", \"Mag\", \"CamStab\",\"CamTrig\",\"Arm\", \"RTH\", \"PosHold\", \"PassThru\", \"HeadFree\", \"Beeper\")";
_labels = new String[]{"Level","AltHold","Mag","CamStab","CamTrig","Arm","RTH","PosHold","PassThru","HeadFree","Beeper"};
 //BA.debugLineNum = 399;BA.debugLine="main_TabHost1.AddTab(\"switchs\",\"switchs.bal\")";
mostCurrent._main_tabhost1.AddTab(mostCurrent.activityBA,"switchs","switchs.bal");
 //BA.debugLineNum = 400;BA.debugLine="For i=0 To 10";
{
final double step324 = 1;
final double limit324 = (int)(10);
for (_i = (int)(0); (step324 > 0 && _i <= limit324) || (step324 < 0 && _i >= limit324); _i += step324) {
 //BA.debugLineNum = 401;BA.debugLine="switchlabel(i).Initialize(\"\")";
mostCurrent._switchlabel[_i].Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 402;BA.debugLine="panellabel.AddView(switchlabel(i),0dip,(30dip*(i+1)),100dip,30dip)";
mostCurrent._panellabel.AddView((android.view.View)(mostCurrent._switchlabel[_i].getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(0)),(int)((anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30))*(_i+1))),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(100)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 403;BA.debugLine="switchlabel(i).Text=labels(i)";
mostCurrent._switchlabel[_i].setText((Object)(_labels[_i]));
 }
};
 //BA.debugLineNum = 405;BA.debugLine="Dim labelaux As Label";
_labelaux = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 406;BA.debugLine="labelaux.Initialize(\"\")";
_labelaux.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 407;BA.debugLine="labelaux.Text=\"Aux1\"";
_labelaux.setText((Object)("Aux1"));
 //BA.debugLineNum = 408;BA.debugLine="panelswitch.panel.AddView(labelaux,40dip,0, 50dip, 30dip)";
mostCurrent._panelswitch.getPanel().AddView((android.view.View)(_labelaux.getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(40)),(int)(0),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(50)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 410;BA.debugLine="a=labelaux.Width";
_a = BA.NumberToString(_labelaux.getWidth());
 //BA.debugLineNum = 411;BA.debugLine="labelaux.Initialize(\"\")";
_labelaux.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 412;BA.debugLine="labelaux.Text=\"Aux2\"";
_labelaux.setText((Object)("Aux2"));
 //BA.debugLineNum = 413;BA.debugLine="panelswitch.panel.AddView(labelaux,155dip,0, 50dip, 30dip)";
mostCurrent._panelswitch.getPanel().AddView((android.view.View)(_labelaux.getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(155)),(int)(0),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(50)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 415;BA.debugLine="labelaux.Initialize(\"\")";
_labelaux.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 416;BA.debugLine="labelaux.Text=\"Aux3\"";
_labelaux.setText((Object)("Aux3"));
 //BA.debugLineNum = 417;BA.debugLine="panelswitch.panel.AddView(labelaux,270dip,0, 50dip, 30dip)";
mostCurrent._panelswitch.getPanel().AddView((android.view.View)(_labelaux.getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(270)),(int)(0),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(50)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 419;BA.debugLine="labelaux.Initialize(\"\")";
_labelaux.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 420;BA.debugLine="labelaux.Text=\"Aux4\"";
_labelaux.setText((Object)("Aux4"));
 //BA.debugLineNum = 421;BA.debugLine="panelswitch.panel.AddView(labelaux,385dip,0, 50dip, 30dip)";
mostCurrent._panelswitch.getPanel().AddView((android.view.View)(_labelaux.getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(385)),(int)(0),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(50)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 424;BA.debugLine="For row=0 To 10";
{
final double step343 = 1;
final double limit343 = (int)(10);
for (_row = (int)(0); (step343 > 0 && _row <= limit343) || (step343 < 0 && _row >= limit343); _row += step343) {
 //BA.debugLineNum = 425;BA.debugLine="For col=0 To 11";
{
final double step344 = 1;
final double limit344 = (int)(11);
for (_col = (int)(0); (step344 > 0 && _col <= limit344) || (step344 < 0 && _col >= limit344); _col += step344) {
 //BA.debugLineNum = 426;BA.debugLine="Dim iz As Int";
_iz = 0;
 //BA.debugLineNum = 427;BA.debugLine="iz=0";
_iz = (int)(0);
 //BA.debugLineNum = 428;BA.debugLine="If 2 < col Then";
if (2<_col) { 
 //BA.debugLineNum = 429;BA.debugLine="iz=1";
_iz = (int)(1);
 };
 //BA.debugLineNum = 431;BA.debugLine="If 5 < col Then";
if (5<_col) { 
 //BA.debugLineNum = 432;BA.debugLine="iz=2";
_iz = (int)(2);
 };
 //BA.debugLineNum = 434;BA.debugLine="If 8< col Then";
if (8<_col) { 
 //BA.debugLineNum = 435;BA.debugLine="iz=3";
_iz = (int)(3);
 };
 //BA.debugLineNum = 438;BA.debugLine="checkbox_switch(row,col).Initialize(\"checkbox_switch\")";
mostCurrent._checkbox_switch[_row][_col].Initialize(mostCurrent.activityBA,"checkbox_switch");
 //BA.debugLineNum = 439;BA.debugLine="panelswitch.panel.AddView(checkbox_switch(row,col),35dip*col+10dip*iz,30dip*(row)+20dip, 35dip, 35dip)";
mostCurrent._panelswitch.getPanel().AddView((android.view.View)(mostCurrent._checkbox_switch[_row][_col].getObject()),(int)(anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(35))*_col+anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(10))*_iz),(int)(anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30))*(_row)+anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(20))),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(35)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(35)));
 }
};
 }
};
 //BA.debugLineNum = 443;BA.debugLine="tabmanager.setTabHeight(main_TabHost1,50dip)";
mostCurrent._tabmanager.setTabHeight((android.widget.TabHost)(mostCurrent._main_tabhost1.getObject()),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(50)));
 //BA.debugLineNum = 444;BA.debugLine="connected_label.Color=Colors.Red";
mostCurrent._connected_label.setColor(anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 445;BA.debugLine="connected_label.Gravity=Gravity.CENTER";
mostCurrent._connected_label.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 446;BA.debugLine="Read.Gravity=Gravity.center";
mostCurrent._read.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 447;BA.debugLine="Write.Gravity=Gravity.CENTER";
mostCurrent._write.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 448;BA.debugLine="last_buffer_size=0";
_last_buffer_size = (int)(0);
 //BA.debugLineNum = 449;BA.debugLine="Read.Enabled=False";
mostCurrent._read.setEnabled(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 450;BA.debugLine="Write.Enabled=False";
mostCurrent._write.setEnabled(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 452;BA.debugLine="End Sub";
return "";
}
public static String  _activity_pause(boolean _userclosed) throws Exception{
 //BA.debugLineNum = 1559;BA.debugLine="Sub Activity_Pause (UserClosed As Boolean)";
 //BA.debugLineNum = 1560;BA.debugLine="If UserClosed = True Then";
if (_userclosed==anywheresoftware.b4a.keywords.Common.True) { 
 //BA.debugLineNum = 1561;BA.debugLine="serial1.Disconnect";
_serial1.Disconnect();
 };
 //BA.debugLineNum = 1563;BA.debugLine="End Sub";
return "";
}
public static String  _activity_resume() throws Exception{
 //BA.debugLineNum = 1522;BA.debugLine="Sub Activity_Resume";
 //BA.debugLineNum = 1525;BA.debugLine="If admin.IsEnabled = False Then";
if (_admin.IsEnabled()==anywheresoftware.b4a.keywords.Common.False) { 
 //BA.debugLineNum = 1526;BA.debugLine="If admin.Enable = False Then";
if (_admin.Enable()==anywheresoftware.b4a.keywords.Common.False) { 
 //BA.debugLineNum = 1527;BA.debugLine="ToastMessageShow(\"Error enabling Bluetooth adapter.\", True)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow("Error enabling Bluetooth adapter.",anywheresoftware.b4a.keywords.Common.True);
 }else {
 //BA.debugLineNum = 1529;BA.debugLine="ToastMessageShow(\"Enabling Bluetooth adapter...\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow("Enabling Bluetooth adapter...",anywheresoftware.b4a.keywords.Common.False);
 };
 }else {
 //BA.debugLineNum = 1533;BA.debugLine="Admin_StateChanged(admin.STATE_ON, 0)";
_admin_statechanged(_admin.STATE_ON,(int)(0));
 //BA.debugLineNum = 1536;BA.debugLine="If connected Then";
if (_connected) { 
 //BA.debugLineNum = 1537;BA.debugLine="connected_label.Text=\"Connected to \" & connected_device";
mostCurrent._connected_label.setText((Object)("Connected to "+_connected_device));
 //BA.debugLineNum = 1538;BA.debugLine="connected_label.Gravity= Gravity.CENTER_HORIZONTAL";
mostCurrent._connected_label.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER_HORIZONTAL);
 //BA.debugLineNum = 1539;BA.debugLine="connected_label.Color=Colors.Green";
mostCurrent._connected_label.setColor(anywheresoftware.b4a.keywords.Common.Colors.Green);
 //BA.debugLineNum = 1540;BA.debugLine="connected_label.TextColor=Colors.Black";
mostCurrent._connected_label.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Black);
 //BA.debugLineNum = 1541;BA.debugLine="Read.Enabled=True";
mostCurrent._read.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 1542;BA.debugLine="Write.Enabled=True";
mostCurrent._write.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 1543;BA.debugLine="read_Click";
_read_click();
 };
 };
 //BA.debugLineNum = 1546;BA.debugLine="End Sub";
return "";
}
public static String  _addrow(String[] _values) throws Exception{
int _lastrow = 0;
int _i = 0;
anywheresoftware.b4a.objects.LabelWrapper _l = null;
main._rowcol _rc = null;
 //BA.debugLineNum = 916;BA.debugLine="Sub AddRow(Values() As String)";
 //BA.debugLineNum = 917;BA.debugLine="If Values.Length <> NumberOfColumns Then";
if (_values.length!=_numberofcolumns) { 
 //BA.debugLineNum = 918;BA.debugLine="Log(\"Wrong number of values.\")";
anywheresoftware.b4a.keywords.Common.Log("Wrong number of values.");
 //BA.debugLineNum = 919;BA.debugLine="Return";
if (true) return "";
 };
 //BA.debugLineNum = 921;BA.debugLine="Dim lastRow As Int";
_lastrow = 0;
 //BA.debugLineNum = 922;BA.debugLine="lastRow = NumberOfRows";
_lastrow = _numberofrows();
 //BA.debugLineNum = 923;BA.debugLine="For i = 0 To NumberOfColumns - 1";
{
final double step745 = 1;
final double limit745 = (int)(_numberofcolumns-1);
for (_i = (int)(0); (step745 > 0 && _i <= limit745) || (step745 < 0 && _i >= limit745); _i += step745) {
 //BA.debugLineNum = 924;BA.debugLine="Dim l As Label";
_l = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 925;BA.debugLine="l.Initialize(\"cell\")";
_l.Initialize(mostCurrent.activityBA,"cell");
 //BA.debugLineNum = 926;BA.debugLine="l.Text = Values(i)";
_l.setText((Object)(_values[_i]));
 //BA.debugLineNum = 927;BA.debugLine="l.Gravity = Alignment";
_l.setGravity(_alignment);
 //BA.debugLineNum = 928;BA.debugLine="l.TextSize = FontSize";
_l.setTextSize(_fontsize);
 //BA.debugLineNum = 929;BA.debugLine="l.TextColor = FontColor";
_l.setTextColor(_fontcolor);
 //BA.debugLineNum = 930;BA.debugLine="l.Color=Colors.White";
_l.setColor(anywheresoftware.b4a.keywords.Common.Colors.White);
 //BA.debugLineNum = 931;BA.debugLine="Dim rc As RowCol";
_rc = new main._rowcol();
 //BA.debugLineNum = 932;BA.debugLine="rc.Initialize";
_rc.Initialize();
 //BA.debugLineNum = 933;BA.debugLine="rc.Col = i";
_rc.Col = _i;
 //BA.debugLineNum = 934;BA.debugLine="rc.Row = lastRow";
_rc.Row = _lastrow;
 //BA.debugLineNum = 935;BA.debugLine="l.Tag = rc";
_l.setTag((Object)(_rc));
 //BA.debugLineNum = 936;BA.debugLine="Table.AddView(l, ColumnWidth * i, RowHeight * lastRow, ColumnWidth_1, RowHeight_1)";
mostCurrent._table.AddView((android.view.View)(_l.getObject()),(int)(_columnwidth*_i),(int)(_rowheight*_lastrow),_columnwidth_1,_rowheight_1);
 }
};
 //BA.debugLineNum = 938;BA.debugLine="Table.Height = NumberOfRows * RowHeight";
mostCurrent._table.setHeight((int)(_numberofrows()*_rowheight));
 //BA.debugLineNum = 939;BA.debugLine="End Sub";
return "";
}
public static String  _admin_devicefound(String _name,String _macaddress) throws Exception{
main._nameandmac _nm = null;
 //BA.debugLineNum = 1597;BA.debugLine="Sub Admin_DeviceFound (Name As String, MacAddress As String)";
 //BA.debugLineNum = 1598;BA.debugLine="Log(Name & \":\" & MacAddress)";
anywheresoftware.b4a.keywords.Common.Log(_name+":"+_macaddress);
 //BA.debugLineNum = 1599;BA.debugLine="Dim nm As NameAndMac";
_nm = new main._nameandmac();
 //BA.debugLineNum = 1600;BA.debugLine="nm.Name = Name";
_nm.Name = _name;
 //BA.debugLineNum = 1601;BA.debugLine="nm.Mac = MacAddress";
_nm.Mac = _macaddress;
 //BA.debugLineNum = 1602;BA.debugLine="foundDevices.Add(nm)";
_founddevices.Add((Object)(_nm));
 //BA.debugLineNum = 1603;BA.debugLine="ProgressDialogShow(\"Searching for devices (~ device found)...\".Replace(\"~\", foundDevices.Size))";
anywheresoftware.b4a.keywords.Common.ProgressDialogShow(mostCurrent.activityBA,"Searching for devices (~ device found)...".replace("~",BA.NumberToString(_founddevices.getSize())));
 //BA.debugLineNum = 1604;BA.debugLine="End Sub";
return "";
}
public static String  _admin_discoveryfinished() throws Exception{
anywheresoftware.b4a.objects.collections.List _l = null;
int _i = 0;
main._nameandmac _nm = null;
int _res = 0;
 //BA.debugLineNum = 1574;BA.debugLine="Sub Admin_DiscoveryFinished";
 //BA.debugLineNum = 1575;BA.debugLine="ProgressDialogHide";
anywheresoftware.b4a.keywords.Common.ProgressDialogHide();
 //BA.debugLineNum = 1576;BA.debugLine="If foundDevices.Size = 0 Then";
if (_founddevices.getSize()==0) { 
 //BA.debugLineNum = 1577;BA.debugLine="ToastMessageShow(\"No device found.\", True)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow("No device found.",anywheresoftware.b4a.keywords.Common.True);
 }else {
 //BA.debugLineNum = 1579;BA.debugLine="Dim l As List";
_l = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 1580;BA.debugLine="l.Initialize";
_l.Initialize();
 //BA.debugLineNum = 1581;BA.debugLine="For i = 0 To foundDevices.Size - 1";
{
final double step1309 = 1;
final double limit1309 = (int)(_founddevices.getSize()-1);
for (_i = (int)(0); (step1309 > 0 && _i <= limit1309) || (step1309 < 0 && _i >= limit1309); _i += step1309) {
 //BA.debugLineNum = 1582;BA.debugLine="Dim nm As NameAndMac";
_nm = new main._nameandmac();
 //BA.debugLineNum = 1583;BA.debugLine="nm = foundDevices.Get(i)";
_nm = (main._nameandmac)(_founddevices.Get(_i));
 //BA.debugLineNum = 1584;BA.debugLine="l.Add(nm.Name)";
_l.Add((Object)(_nm.Name));
 }
};
 //BA.debugLineNum = 1586;BA.debugLine="Dim res As Int";
_res = 0;
 //BA.debugLineNum = 1587;BA.debugLine="res = InputList(l, \"Choose device to connect\", -1)";
_res = anywheresoftware.b4a.keywords.Common.InputList(_l,"Choose device to connect",(int)(-1),mostCurrent.activityBA);
 //BA.debugLineNum = 1588;BA.debugLine="If res <> DialogResponse.CANCEL Then";
if (_res!=anywheresoftware.b4a.keywords.Common.DialogResponse.CANCEL) { 
 //BA.debugLineNum = 1589;BA.debugLine="connectedDevice = foundDevices.Get(res)";
_connecteddevice = (main._nameandmac)(_founddevices.Get(_res));
 //BA.debugLineNum = 1590;BA.debugLine="ProgressDialogShow(\"Trying to connect to: \" & connectedDevice.Name & \" (\" & connectedDevice.Mac & \")\")";
anywheresoftware.b4a.keywords.Common.ProgressDialogShow(mostCurrent.activityBA,"Trying to connect to: "+_connecteddevice.Name+" ("+_connecteddevice.Mac+")");
 //BA.debugLineNum = 1591;BA.debugLine="serial1.connect(connectedDevice.Mac)";
_serial1.Connect(processBA,_connecteddevice.Mac);
 };
 };
 //BA.debugLineNum = 1595;BA.debugLine="End Sub";
return "";
}
public static String  _admin_statechanged(int _newstate,int _oldstate) throws Exception{
long _ti = 0L;
 //BA.debugLineNum = 1548;BA.debugLine="Sub Admin_StateChanged (NewState As Int, OldState As Int)";
 //BA.debugLineNum = 1549;BA.debugLine="If return_from_cli Then";
if (_return_from_cli) { 
 //BA.debugLineNum = 1550;BA.debugLine="Dim Ti As Long";
_ti = 0L;
 //BA.debugLineNum = 1551;BA.debugLine="Ti = DateTime.Now + (200)";
_ti = (long)(anywheresoftware.b4a.keywords.Common.DateTime.getNow()+(200));
 //BA.debugLineNum = 1552;BA.debugLine="Do While DateTime.Now < Ti";
while (anywheresoftware.b4a.keywords.Common.DateTime.getNow()<_ti) {
 //BA.debugLineNum = 1553;BA.debugLine="DoEvents";
anywheresoftware.b4a.keywords.Common.DoEvents();
 }
;
 //BA.debugLineNum = 1555;BA.debugLine="read_Click";
_read_click();
 };
 //BA.debugLineNum = 1557;BA.debugLine="End Sub";
return "";
}
public static String  _animation1_animationend() throws Exception{
 //BA.debugLineNum = 1651;BA.debugLine="Sub Animation1_AnimationEnd";
 //BA.debugLineNum = 1653;BA.debugLine="SlidingPanels.AnimationEnd(sdi)";
mostCurrent._slidingpanels._animationend(mostCurrent.activityBA,mostCurrent._sdi);
 //BA.debugLineNum = 1654;BA.debugLine="If sdi.targetPanel >= 0 Then";
if (mostCurrent._sdi.targetPanel>=0) { 
 //BA.debugLineNum = 1655;BA.debugLine="tmrAnimation.Enabled = True";
_tmranimation.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 1656;BA.debugLine="Return 'we are still animating...";
if (true) return "";
 };
 //BA.debugLineNum = 1659;BA.debugLine="If sdi.currentPanel = 3 Then";
if (mostCurrent._sdi.currentPanel==3) { 
 //BA.debugLineNum = 1660;BA.debugLine="If gps_reading=False Then";
if (_gps_reading==anywheresoftware.b4a.keywords.Common.False) { 
 //BA.debugLineNum = 1661;BA.debugLine="gps_reading=True";
_gps_reading = anywheresoftware.b4a.keywords.Common.True;
 //BA.debugLineNum = 1662;BA.debugLine="Timer1.Interval=75";
_timer1.setInterval((long)(75));
 }else {
 //BA.debugLineNum = 1665;BA.debugLine="gps_reading=False";
_gps_reading = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1666;BA.debugLine="Timer1.Interval=200";
_timer1.setInterval((long)(200));
 };
 };
 //BA.debugLineNum = 1676;BA.debugLine="End Sub";
return "";
}
public static String  _btnsearchfordevices_click() throws Exception{
 //BA.debugLineNum = 1565;BA.debugLine="Sub btnSearchForDevices_Click";
 //BA.debugLineNum = 1566;BA.debugLine="foundDevices.Initialize";
_founddevices.Initialize();
 //BA.debugLineNum = 1567;BA.debugLine="If admin.StartDiscovery	= False Then";
if (_admin.StartDiscovery()==anywheresoftware.b4a.keywords.Common.False) { 
 //BA.debugLineNum = 1568;BA.debugLine="ToastMessageShow(\"Error starting discovery process.\", True)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow("Error starting discovery process.",anywheresoftware.b4a.keywords.Common.True);
 }else {
 //BA.debugLineNum = 1570;BA.debugLine="ProgressDialogShow(\"Searching for devices...\")";
anywheresoftware.b4a.keywords.Common.ProgressDialogShow(mostCurrent.activityBA,"Searching for devices...");
 };
 //BA.debugLineNum = 1572;BA.debugLine="End Sub";
return "";
}
public static String  _calacc_click() throws Exception{
 //BA.debugLineNum = 1484;BA.debugLine="Sub calacc_click()";
 //BA.debugLineNum = 1485;BA.debugLine="If connected Then";
if (_connected) { 
 //BA.debugLineNum = 1486;BA.debugLine="If protocol=0 Then";
if (_protocol==0) { 
 //BA.debugLineNum = 1487;BA.debugLine="TextWriter1.Write(\"S\")";
_textwriter1.Write("S");
 //BA.debugLineNum = 1488;BA.debugLine="TextWriter1.Flush";
_textwriter1.Flush();
 }else {
 //BA.debugLineNum = 1490;BA.debugLine="TextWriter1.Write(\"$M<\"&Chr(MSP_ACC_CALIBRATION))";
_textwriter1.Write("$M<"+String.valueOf(anywheresoftware.b4a.keywords.Common.Chr((int)(Double.parseDouble(_msp_acc_calibration)))));
 //BA.debugLineNum = 1491;BA.debugLine="TextWriter1.Flush";
_textwriter1.Flush();
 };
 };
 //BA.debugLineNum = 1494;BA.debugLine="End Sub";
return "";
}
public static String  _calmag_click() throws Exception{
 //BA.debugLineNum = 1473;BA.debugLine="Sub calmag_click()";
 //BA.debugLineNum = 1474;BA.debugLine="If connected Then";
if (_connected) { 
 //BA.debugLineNum = 1475;BA.debugLine="If protocol=0 Then";
if (_protocol==0) { 
 //BA.debugLineNum = 1476;BA.debugLine="TextWriter1.Write(\"E\")";
_textwriter1.Write("E");
 //BA.debugLineNum = 1477;BA.debugLine="TextWriter1.Flush";
_textwriter1.Flush();
 }else {
 //BA.debugLineNum = 1479;BA.debugLine="TextWriter1.Write(\"$M<\"&Chr(MSP_MAG_CALIBRATION))";
_textwriter1.Write("$M<"+String.valueOf(anywheresoftware.b4a.keywords.Common.Chr((int)(Double.parseDouble(_msp_mag_calibration)))));
 //BA.debugLineNum = 1480;BA.debugLine="TextWriter1.Flush";
_textwriter1.Flush();
 };
 };
 //BA.debugLineNum = 1483;BA.debugLine="End Sub";
return "";
}
public static String  _cell_click() throws Exception{
main._rowcol _rc = null;
anywheresoftware.b4a.objects.LabelWrapper _l = null;
anywheresoftware.b4a.objects.PanelWrapper _pnl = null;
anywheresoftware.b4a.objects.drawable.ColorDrawable _bgnd = null;
String _a = "";
String _ret = "";
byte[] _arr = null;
int _i = 0;
String _texttosend = "";
 //BA.debugLineNum = 824;BA.debugLine="Sub Cell_Click";
 //BA.debugLineNum = 825;BA.debugLine="Dim rc As RowCol";
_rc = new main._rowcol();
 //BA.debugLineNum = 826;BA.debugLine="Dim l As Label";
_l = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 827;BA.debugLine="l = Sender";
_l.setObject((android.widget.TextView)(anywheresoftware.b4a.keywords.Common.Sender(mostCurrent.activityBA)));
 //BA.debugLineNum = 828;BA.debugLine="rc = l.Tag";
_rc = (main._rowcol)(_l.getTag());
 //BA.debugLineNum = 830;BA.debugLine="GetView(rc.Row, rc.col).Color = SelectedRowColor";
_getview(_rc.Row,_rc.Col).setColor(_selectedrowcolor);
 //BA.debugLineNum = 833;BA.debugLine="Dim pnl As Panel";
_pnl = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 834;BA.debugLine="pnl.Initialize(\"pnl\")";
_pnl.Initialize(mostCurrent.activityBA,"pnl");
 //BA.debugLineNum = 835;BA.debugLine="Dim bgnd As ColorDrawable";
_bgnd = new anywheresoftware.b4a.objects.drawable.ColorDrawable();
 //BA.debugLineNum = 836;BA.debugLine="bgnd.Initialize(Colors.Black, 5dip)";
_bgnd.Initialize(anywheresoftware.b4a.keywords.Common.Colors.Black,anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(5)));
 //BA.debugLineNum = 837;BA.debugLine="pnl.Background = bgnd";
_pnl.setBackground((android.graphics.drawable.Drawable)(_bgnd.getObject()));
 //BA.debugLineNum = 840;BA.debugLine="lbl2.Initialize(\"lbl2\")";
mostCurrent._lbl2.Initialize(mostCurrent.activityBA,"lbl2");
 //BA.debugLineNum = 841;BA.debugLine="sk1.Initialize(\"sk1\")";
mostCurrent._sk1.Initialize(mostCurrent.activityBA,"sk1");
 //BA.debugLineNum = 842;BA.debugLine="what_col=rc.Col";
_what_col = _rc.Col;
 //BA.debugLineNum = 843;BA.debugLine="If rc.Col=1 Then";
if (_rc.Col==1) { 
 //BA.debugLineNum = 844;BA.debugLine="sk1.Value=GetView(rc.Row,rc.Col).Text*10";
mostCurrent._sk1.setValue((int)((double)(Double.parseDouble(_getview(_rc.Row,_rc.Col).getText()))*10));
 //BA.debugLineNum = 845;BA.debugLine="lbl2.Text=GetView(rc.Row,rc.Col).Text";
mostCurrent._lbl2.setText((Object)(_getview(_rc.Row,_rc.Col).getText()));
 };
 //BA.debugLineNum = 847;BA.debugLine="If rc.Col=2 Then";
if (_rc.Col==2) { 
 //BA.debugLineNum = 848;BA.debugLine="sk1.Value=GetView(rc.Row,rc.Col).Text*1000";
mostCurrent._sk1.setValue((int)((double)(Double.parseDouble(_getview(_rc.Row,_rc.Col).getText()))*1000));
 //BA.debugLineNum = 849;BA.debugLine="lbl2.Text=GetView(rc.Row,rc.Col).Text";
mostCurrent._lbl2.setText((Object)(_getview(_rc.Row,_rc.Col).getText()));
 };
 //BA.debugLineNum = 851;BA.debugLine="If rc.Col=3 Then";
if (_rc.Col==3) { 
 //BA.debugLineNum = 852;BA.debugLine="sk1.Value=GetView(rc.Row,rc.Col).Text";
mostCurrent._sk1.setValue((int)(Double.parseDouble(_getview(_rc.Row,_rc.Col).getText())));
 //BA.debugLineNum = 853;BA.debugLine="lbl2.Text=GetView(rc.Row,rc.Col).Text";
mostCurrent._lbl2.setText((Object)(_getview(_rc.Row,_rc.Col).getText()));
 };
 //BA.debugLineNum = 856;BA.debugLine="pnl.AddView(sk1,5%x,10%y,70%x,35dip)";
_pnl.AddView((android.view.View)(mostCurrent._sk1.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(5),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(70),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(35)));
 //BA.debugLineNum = 857;BA.debugLine="lbl2.Gravity=Gravity.CENTER";
mostCurrent._lbl2.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 858;BA.debugLine="pnl.AddView(lbl2,20%x,0%y,20%x,30dip)";
_pnl.AddView((android.view.View)(mostCurrent._lbl2.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(20),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(0),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(20),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 859;BA.debugLine="cd.AddView(pnl, 0%x, 0%y, 80%x, 20%y) ' sizing relative to the screen size is probably best";
mostCurrent._cd.AddView((android.view.View)(_pnl.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(0),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(0),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(80),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(20),mostCurrent.activityBA));
 //BA.debugLineNum = 860;BA.debugLine="a= pnl.Width/2-lbl2.Width/2";
_a = BA.NumberToString(_pnl.getWidth()/(double)2-mostCurrent._lbl2.getWidth()/(double)2);
 //BA.debugLineNum = 861;BA.debugLine="lbl2.Left=a";
mostCurrent._lbl2.setLeft((int)(Double.parseDouble(_a)));
 //BA.debugLineNum = 862;BA.debugLine="ret = cd.Show(\"\", \"Ok\", \"Cancel\", \"\", Null)";
_ret = BA.NumberToString(mostCurrent._cd.Show("","Ok","Cancel","",mostCurrent.activityBA,(android.graphics.Bitmap)(anywheresoftware.b4a.keywords.Common.Null)));
 //BA.debugLineNum = 863;BA.debugLine="If ret=DialogResponse.POSITIVE Then";
if ((_ret).equals(BA.NumberToString(anywheresoftware.b4a.keywords.Common.DialogResponse.POSITIVE))) { 
 //BA.debugLineNum = 864;BA.debugLine="If rc.Col=1 Then";
if (_rc.Col==1) { 
 //BA.debugLineNum = 865;BA.debugLine="GetView(rc.Row,rc.Col).Text=valor/10";
_getview(_rc.Row,_rc.Col).setText((Object)(_valor/(double)10));
 };
 //BA.debugLineNum = 867;BA.debugLine="If rc.Col=2 Then";
if (_rc.Col==2) { 
 //BA.debugLineNum = 868;BA.debugLine="GetView(rc.Row,rc.Col).Text=valor/1000";
_getview(_rc.Row,_rc.Col).setText((Object)(_valor/(double)1000));
 };
 //BA.debugLineNum = 870;BA.debugLine="If rc.Col=3 Then";
if (_rc.Col==3) { 
 //BA.debugLineNum = 871;BA.debugLine="GetView(rc.Row,rc.Col).Text=valor";
_getview(_rc.Row,_rc.Col).setText((Object)(_valor));
 };
 //BA.debugLineNum = 873;BA.debugLine="GetView(rc.Row, rc.Col).Color = Colors.RGB(240,128,128)";
_getview(_rc.Row,_rc.Col).setColor(anywheresoftware.b4a.keywords.Common.Colors.RGB((int)(240),(int)(128),(int)(128)));
 //BA.debugLineNum = 874;BA.debugLine="checksum=0";
_checksum = (byte)(0);
 //BA.debugLineNum = 875;BA.debugLine="Dim arr(100) As Byte";
_arr = new byte[(int)(100)];
;
 //BA.debugLineNum = 876;BA.debugLine="arr(0)= Asc(\"$\")";
_arr[(int)(0)] = (byte)(anywheresoftware.b4a.keywords.Common.Asc(BA.ObjectToChar("$")));
 //BA.debugLineNum = 877;BA.debugLine="arr(1)=Asc(\"M\")";
_arr[(int)(1)] = (byte)(anywheresoftware.b4a.keywords.Common.Asc(BA.ObjectToChar("M")));
 //BA.debugLineNum = 878;BA.debugLine="arr(2)=Asc(\"<\")";
_arr[(int)(2)] = (byte)(anywheresoftware.b4a.keywords.Common.Asc(BA.ObjectToChar("<")));
 //BA.debugLineNum = 879;BA.debugLine="arr(3)=3*PIDITEMS";
_arr[(int)(3)] = (byte)(3*_piditems);
 //BA.debugLineNum = 880;BA.debugLine="arr(4)=MSP_SET_PID";
_arr[(int)(4)] = (byte)(Double.parseDouble(_msp_set_pid));
 //BA.debugLineNum = 881;BA.debugLine="arr(5)=GetView(0,1).text * 10";
_arr[(int)(5)] = (byte)((double)(Double.parseDouble(_getview((int)(0),(int)(1)).getText()))*10);
 //BA.debugLineNum = 882;BA.debugLine="arr(6)=GetView(0,2).text * 1000";
_arr[(int)(6)] = (byte)((double)(Double.parseDouble(_getview((int)(0),(int)(2)).getText()))*1000);
 //BA.debugLineNum = 883;BA.debugLine="arr(7)=GetView(0,3).text";
_arr[(int)(7)] = (byte)(Double.parseDouble(_getview((int)(0),(int)(3)).getText()));
 //BA.debugLineNum = 884;BA.debugLine="For i=0 To 5";
{
final double step709 = 1;
final double limit709 = (int)(5);
for (_i = (int)(0); (step709 > 0 && _i <= limit709) || (step709 < 0 && _i >= limit709); _i += step709) {
 //BA.debugLineNum = 885;BA.debugLine="arr(8+3*i)=GetView(i,1).text * 10";
_arr[(int)(8+3*_i)] = (byte)((double)(Double.parseDouble(_getview(_i,(int)(1)).getText()))*10);
 //BA.debugLineNum = 886;BA.debugLine="arr(9+3*i)=GetView(i,2).text * 1000";
_arr[(int)(9+3*_i)] = (byte)((double)(Double.parseDouble(_getview(_i,(int)(2)).getText()))*1000);
 //BA.debugLineNum = 887;BA.debugLine="arr(10+3*i)=GetView(i,3).text";
_arr[(int)(10+3*_i)] = (byte)(Double.parseDouble(_getview(_i,(int)(3)).getText()));
 }
};
 //BA.debugLineNum = 889;BA.debugLine="arr(26)= GetView(6,1).text*10";
_arr[(int)(26)] = (byte)((double)(Double.parseDouble(_getview((int)(6),(int)(1)).getText()))*10);
 //BA.debugLineNum = 890;BA.debugLine="arr(27)=0";
_arr[(int)(27)] = (byte)(0);
 //BA.debugLineNum = 891;BA.debugLine="arr(28)=0";
_arr[(int)(28)] = (byte)(0);
 //BA.debugLineNum = 892;BA.debugLine="For i= 5 To 28";
{
final double step717 = 1;
final double limit717 = (int)(28);
for (_i = (int)(5); (step717 > 0 && _i <= limit717) || (step717 < 0 && _i >= limit717); _i += step717) {
 //BA.debugLineNum = 893;BA.debugLine="checksum =Bit.Xor(checksum,arr(i))";
_checksum = (byte)(anywheresoftware.b4a.keywords.Common.Bit.Xor((int)(_checksum),(int)(_arr[_i])));
 }
};
 //BA.debugLineNum = 895;BA.debugLine="arr(29)=checksum";
_arr[(int)(29)] = _checksum;
 //BA.debugLineNum = 896;BA.debugLine="Dim texttosend As String";
_texttosend = "";
 //BA.debugLineNum = 897;BA.debugLine="texttosend=converter.StringFromBytes(arr,\"ISO-8859-1\")";
_texttosend = _converter.StringFromBytes(_arr,"ISO-8859-1");
 //BA.debugLineNum = 898;BA.debugLine="TextWriter1.Write(texttosend)";
_textwriter1.Write(_texttosend);
 //BA.debugLineNum = 899;BA.debugLine="TextWriter1.flush";
_textwriter1.Flush();
 };
 //BA.debugLineNum = 902;BA.debugLine="End Sub";
return "";
}
public static String  _changepanel(boolean _left) throws Exception{
 //BA.debugLineNum = 1645;BA.debugLine="Sub ChangePanel(Left As Boolean)";
 //BA.debugLineNum = 1649;BA.debugLine="SlidingPanels.ChangePanel(sdi, Left)";
mostCurrent._slidingpanels._changepanel(mostCurrent.activityBA,mostCurrent._sdi,_left);
 //BA.debugLineNum = 1650;BA.debugLine="End Sub";
return "";
}
public static String  _checkbox_switch_checkedchange(boolean _checked) throws Exception{
 //BA.debugLineNum = 524;BA.debugLine="Sub checkbox_switch_CheckedChange(checked As Boolean)";
 //BA.debugLineNum = 560;BA.debugLine="End Sub";
return "";
}
public static String  _chooseprotocol_click() throws Exception{
anywheresoftware.b4a.objects.collections.List _prot = null;
String _res = "";
 //BA.debugLineNum = 641;BA.debugLine="Sub chooseprotocol_Click";
 //BA.debugLineNum = 642;BA.debugLine="Dim prot As List";
_prot = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 643;BA.debugLine="prot.Initialize";
_prot.Initialize();
 //BA.debugLineNum = 644;BA.debugLine="prot.AddAll(Array As String(\"old Protocol\",\"New Protocol r152\"))";
_prot.AddAll(anywheresoftware.b4a.keywords.Common.ArrayToList(new String[]{"old Protocol","New Protocol r152"}));
 //BA.debugLineNum = 645;BA.debugLine="res = InputList(prot, \"Choose Protocol\", -1)";
_res = BA.NumberToString(anywheresoftware.b4a.keywords.Common.InputList(_prot,"Choose Protocol",(int)(-1),mostCurrent.activityBA));
 //BA.debugLineNum = 646;BA.debugLine="If res <> DialogResponse.CANCEL Then";
if ((_res).equals(BA.NumberToString(anywheresoftware.b4a.keywords.Common.DialogResponse.CANCEL)) == false) { 
 //BA.debugLineNum = 647;BA.debugLine="protocol= res";
_protocol = (int)(Double.parseDouble(_res));
 };
 //BA.debugLineNum = 649;BA.debugLine="End Sub";
return "";
}
public static String  _clearall() throws Exception{
int _i = 0;
 //BA.debugLineNum = 971;BA.debugLine="Sub ClearAll";
 //BA.debugLineNum = 972;BA.debugLine="For i = Table.NumberOfViews -1 To 0 Step -1";
{
final double step791 = -1;
final double limit791 = (int)(0);
for (_i = (int)(mostCurrent._table.getNumberOfViews()-1); (step791 > 0 && _i <= limit791) || (step791 < 0 && _i >= limit791); _i += step791) {
 //BA.debugLineNum = 973;BA.debugLine="Table.RemoveViewAt(i)";
mostCurrent._table.RemoveViewAt(_i);
 }
};
 //BA.debugLineNum = 975;BA.debugLine="Table.Height = 0";
mostCurrent._table.setHeight((int)(0));
 //BA.debugLineNum = 976;BA.debugLine="SelectedRow = -1";
_selectedrow = (int)(-1);
 //BA.debugLineNum = 977;BA.debugLine="End Sub";
return "";
}
public static String  _cli_settings_click() throws Exception{
 //BA.debugLineNum = 652;BA.debugLine="Sub cli_settings_Click()";
 //BA.debugLineNum = 653;BA.debugLine="If connected Then";
if (_connected) { 
 //BA.debugLineNum = 654;BA.debugLine="StartActivity(cli)";
anywheresoftware.b4a.keywords.Common.StartActivity(mostCurrent.activityBA,(Object)(mostCurrent._cli.getObject()));
 };
 //BA.debugLineNum = 656;BA.debugLine="End Sub";
return "";
}
public static String  _connect_click() throws Exception{
anywheresoftware.b4a.objects.collections.Map _paireddevices = null;
anywheresoftware.b4a.objects.collections.List _l = null;
int _i = 0;
int _res = 0;
 //BA.debugLineNum = 1495;BA.debugLine="Sub connect_click()";
 //BA.debugLineNum = 1497;BA.debugLine="Dim PairedDevices As Map";
_paireddevices = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 1498;BA.debugLine="PairedDevices = serial1.GetPairedDevices";
_paireddevices = _serial1.GetPairedDevices();
 //BA.debugLineNum = 1499;BA.debugLine="Dim l As List";
_l = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 1500;BA.debugLine="l.Initialize";
_l.Initialize();
 //BA.debugLineNum = 1501;BA.debugLine="For i = 0 To PairedDevices.Size - 1";
{
final double step1240 = 1;
final double limit1240 = (int)(_paireddevices.getSize()-1);
for (_i = (int)(0); (step1240 > 0 && _i <= limit1240) || (step1240 < 0 && _i >= limit1240); _i += step1240) {
 //BA.debugLineNum = 1502;BA.debugLine="l.Add(PairedDevices.GetKeyAt(i))";
_l.Add(_paireddevices.GetKeyAt(_i));
 }
};
 //BA.debugLineNum = 1504;BA.debugLine="Dim res As Int";
_res = 0;
 //BA.debugLineNum = 1505;BA.debugLine="res = InputList(l, \"Choose device\", -1) 'show list with paired devices";
_res = anywheresoftware.b4a.keywords.Common.InputList(_l,"Choose device",(int)(-1),mostCurrent.activityBA);
 //BA.debugLineNum = 1506;BA.debugLine="If res <> DialogResponse.CANCEL Then";
if (_res!=anywheresoftware.b4a.keywords.Common.DialogResponse.CANCEL) { 
 //BA.debugLineNum = 1507;BA.debugLine="serial1.connect(PairedDevices.Get(l.Get(res))) 'convert the name to mac address";
_serial1.Connect(processBA,String.valueOf(_paireddevices.Get(_l.Get(_res))));
 //BA.debugLineNum = 1508;BA.debugLine="connected_device=l.Get(res)";
_connected_device = String.valueOf(_l.Get(_res));
 };
 //BA.debugLineNum = 1511;BA.debugLine="End Sub";
return "";
}
public static String  _connected_label_click() throws Exception{
 //BA.debugLineNum = 1637;BA.debugLine="Sub connected_label_Click";
 //BA.debugLineNum = 1638;BA.debugLine="If connected Then";
if (_connected) { 
 //BA.debugLineNum = 1639;BA.debugLine="disconnect_click";
_disconnect_click();
 }else {
 //BA.debugLineNum = 1641;BA.debugLine="connect_click";
_connect_click();
 };
 //BA.debugLineNum = 1644;BA.debugLine="End Sub";
return "";
}
public static String  _continuejumping() throws Exception{
int _i = 0;
 //BA.debugLineNum = 1690;BA.debugLine="Sub ContinueJumping";
 //BA.debugLineNum = 1691;BA.debugLine="If sdi.targetPanel < 0 OR sdi.targetPanel = sdi.currentPanel Then";
if (mostCurrent._sdi.targetPanel<0 || mostCurrent._sdi.targetPanel==mostCurrent._sdi.currentPanel) { 
 //BA.debugLineNum = 1692;BA.debugLine="sdi.targetPanel = -1";
mostCurrent._sdi.targetPanel = (int)(-1);
 //BA.debugLineNum = 1693;BA.debugLine="Animation1_AnimationEnd";
_animation1_animationend();
 //BA.debugLineNum = 1694;BA.debugLine="For i = 0 To 1";
{
final double step1402 = 1;
final double limit1402 = (int)(1);
for (_i = (int)(0); (step1402 > 0 && _i <= limit1402) || (step1402 < 0 && _i >= limit1402); _i += step1402) {
 //BA.debugLineNum = 1695;BA.debugLine="sdi.leftAnimations(i).Duration = SlidingDuration";
mostCurrent._sdi.LeftAnimations[_i].setDuration((long)(_slidingduration));
 //BA.debugLineNum = 1696;BA.debugLine="sdi.rightAnimations(i).Duration = SlidingDuration";
mostCurrent._sdi.RightAnimations[_i].setDuration((long)(_slidingduration));
 }
};
 //BA.debugLineNum = 1698;BA.debugLine="Return";
if (true) return "";
 };
 //BA.debugLineNum = 1700;BA.debugLine="SlidingPanels.ChangePanel(sdi, sdi.targetPanel > sdi.currentPanel)";
mostCurrent._slidingpanels._changepanel(mostCurrent.activityBA,mostCurrent._sdi,mostCurrent._sdi.targetPanel>mostCurrent._sdi.currentPanel);
 //BA.debugLineNum = 1701;BA.debugLine="End Sub";
return "";
}
public static String  _disconnect_click() throws Exception{
 //BA.debugLineNum = 1512;BA.debugLine="Sub disconnect_click()";
 //BA.debugLineNum = 1514;BA.debugLine="serial1.Disconnect";
_serial1.Disconnect();
 //BA.debugLineNum = 1515;BA.debugLine="connected = False";
_connected = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1516;BA.debugLine="Read.Enabled=False";
mostCurrent._read.setEnabled(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 1517;BA.debugLine="Write.Enabled=False";
mostCurrent._write.setEnabled(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 1518;BA.debugLine="connected_label.Text=\"Not Connected\"";
mostCurrent._connected_label.setText((Object)("Not Connected"));
 //BA.debugLineNum = 1519;BA.debugLine="connected_label.Gravity= Gravity.CENTER_HORIZONTAL";
mostCurrent._connected_label.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER_HORIZONTAL);
 //BA.debugLineNum = 1520;BA.debugLine="connected_label.Color=Colors.Red";
mostCurrent._connected_label.setColor(anywheresoftware.b4a.keywords.Common.Colors.Red);
 //BA.debugLineNum = 1521;BA.debugLine="End Sub";
return "";
}
public static String  _getcell(int _row,int _col) throws Exception{
 //BA.debugLineNum = 968;BA.debugLine="Sub GetCell(Row As Int, Col As Int) As String";
 //BA.debugLineNum = 969;BA.debugLine="Return GetView(Row, Col).Text";
if (true) return _getview(_row,_col).getText();
 //BA.debugLineNum = 970;BA.debugLine="End Sub";
return "";
}
public static anywheresoftware.b4a.objects.LabelWrapper  _getview(int _row,int _col) throws Exception{
anywheresoftware.b4a.objects.LabelWrapper _l = null;
 //BA.debugLineNum = 911;BA.debugLine="Sub GetView(Row As Int, Col As Int) As Label";
 //BA.debugLineNum = 912;BA.debugLine="Dim l As Label";
_l = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 913;BA.debugLine="l = Table.GetView(Row * NumberOfColumns + Col)";
_l.setObject((android.widget.TextView)(mostCurrent._table.GetView((int)(_row*_numberofcolumns+_col)).getObject()));
 //BA.debugLineNum = 914;BA.debugLine="Return l";
if (true) return _l;
 //BA.debugLineNum = 915;BA.debugLine="End Sub";
return null;
}

public static void initializeProcessGlobals() {
    
    if (processGlobalsRun == false) {
	    processGlobalsRun = true;
		try {
		        main._process_globals();
cli._process_globals();
slidingpanels._process_globals();
oscilo._process_globals();
		
        } catch (Exception e) {
			throw new RuntimeException(e);
		}
    }
}
public static String  _globals() throws Exception{
 //BA.debugLineNum = 57;BA.debugLine="Sub Globals";
 //BA.debugLineNum = 59;BA.debugLine="Dim main_TabHost1 As TabHost";
mostCurrent._main_tabhost1 = new anywheresoftware.b4a.objects.TabHostWrapper();
 //BA.debugLineNum = 60;BA.debugLine="Dim tabmanager As TabHostExtras";
mostCurrent._tabmanager = new uk.co.martinpearman.b4a.tabhostextras.TabHostExtras();
 //BA.debugLineNum = 61;BA.debugLine="Dim sk1 As SeekBar";
mostCurrent._sk1 = new anywheresoftware.b4a.objects.SeekBarWrapper();
 //BA.debugLineNum = 62;BA.debugLine="Dim cd As CustomDialog";
mostCurrent._cd = new anywheresoftware.b4a.agraham.dialogs.InputDialog.CustomDialog();
 //BA.debugLineNum = 63;BA.debugLine="Dim lbl2 As Label";
mostCurrent._lbl2 = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 64;BA.debugLine="Dim txtbox As EditText";
mostCurrent._txtbox = new anywheresoftware.b4a.objects.EditTextWrapper();
 //BA.debugLineNum = 65;BA.debugLine="Dim connected_label As Label";
mostCurrent._connected_label = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 66;BA.debugLine="Dim valor As Int";
_valor = 0;
 //BA.debugLineNum = 69;BA.debugLine="Dim SV As ScrollView";
mostCurrent._sv = new anywheresoftware.b4a.objects.ScrollViewWrapper();
 //BA.debugLineNum = 70;BA.debugLine="Dim Header As Panel";
mostCurrent._header = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 71;BA.debugLine="Dim Table As Panel";
mostCurrent._table = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 72;BA.debugLine="Dim main_TabHost1_Panel As Panel";
mostCurrent._main_tabhost1_panel = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 73;BA.debugLine="Dim NumberOfColumns, RowHeight, RowHeight_1, ColumnWidth, ColumnWidth_1 As Int";
_numberofcolumns = 0;
_rowheight = 0;
_rowheight_1 = 0;
_columnwidth = 0;
_columnwidth_1 = 0;
 //BA.debugLineNum = 75;BA.debugLine="Dim HeaderColor, LineColor, CellColor, FontColor, HeaderFontColor As Int";
_headercolor = 0;
_linecolor = 0;
_cellcolor = 0;
_fontcolor = 0;
_headerfontcolor = 0;
 //BA.debugLineNum = 76;BA.debugLine="Dim FontSize As Float";
_fontsize = 0f;
 //BA.debugLineNum = 77;BA.debugLine="Type RowCol (Row As Int, Col As Int)";
;
 //BA.debugLineNum = 78;BA.debugLine="Dim Alignment As Int";
_alignment = 0;
 //BA.debugLineNum = 79;BA.debugLine="Dim SelectedRow As Int";
_selectedrow = 0;
 //BA.debugLineNum = 80;BA.debugLine="Dim SelectedRowColor As Int";
_selectedrowcolor = 0;
 //BA.debugLineNum = 81;BA.debugLine="Dim selectedcell(2) As Int";
_selectedcell = new int[(int)(2)];
;
 //BA.debugLineNum = 82;BA.debugLine="Dim ColLineWidth, RowLineWidth As Int";
_collinewidth = 0;
_rowlinewidth = 0;
 //BA.debugLineNum = 85;BA.debugLine="Dim checkboxitems As Int";
_checkboxitems = 0;
 //BA.debugLineNum = 86;BA.debugLine="checkboxitems=11";
_checkboxitems = (int)(11);
 //BA.debugLineNum = 87;BA.debugLine="Dim PIDITEMS As Int";
_piditems = 0;
 //BA.debugLineNum = 88;BA.debugLine="PIDITEMS=8";
_piditems = (int)(8);
 //BA.debugLineNum = 89;BA.debugLine="Dim commListMax As Int";
_commlistmax = 0;
 //BA.debugLineNum = 90;BA.debugLine="Dim frame_size_read As Int";
_frame_size_read = 0;
 //BA.debugLineNum = 91;BA.debugLine="frame_size_read = 108+3*PIDITEMS+2*checkboxitems";
_frame_size_read = (int)(108+3*_piditems+2*_checkboxitems);
 //BA.debugLineNum = 92;BA.debugLine="Dim frame_size_write As Int";
_frame_size_write = 0;
 //BA.debugLineNum = 93;BA.debugLine="frame_size_write= 8+3*PIDITEMS+2*checkboxitems";
_frame_size_write = (int)(8+3*_piditems+2*_checkboxitems);
 //BA.debugLineNum = 94;BA.debugLine="Dim byteP(PIDITEMS) As Int";
_bytep = new int[_piditems];
;
 //BA.debugLineNum = 95;BA.debugLine="Dim byteI(PIDITEMS) As Int";
_bytei = new int[_piditems];
;
 //BA.debugLineNum = 96;BA.debugLine="Dim byteD(PIDITEMS) As Int";
_byted = new int[_piditems];
;
 //BA.debugLineNum = 97;BA.debugLine="Dim what_col As Int";
_what_col = 0;
 //BA.debugLineNum = 98;BA.debugLine="Dim checkeado(11) As Boolean";
_checkeado = new boolean[(int)(11)];
;
 //BA.debugLineNum = 101;BA.debugLine="Dim GPS_distanceToHome,GPS_directionToHome,GPS_numSat,GPS_fix,GPS_update, pMeterSum,intPowerTrigger,bytevbat As Int";
_gps_distancetohome = 0;
_gps_directiontohome = 0;
_gps_numsat = 0;
_gps_fix = 0;
_gps_update = 0;
_pmetersum = 0;
_intpowertrigger = 0;
_bytevbat = 0;
 //BA.debugLineNum = 104;BA.debugLine="Dim radio_panel As Panel";
mostCurrent._radio_panel = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 105;BA.debugLine="Dim RollPitchRate As Label";
mostCurrent._rollpitchrate = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 106;BA.debugLine="Dim YawRate As Label";
mostCurrent._yawrate = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 107;BA.debugLine="Dim ThrottlePidAtt As Label";
mostCurrent._throttlepidatt = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 108;BA.debugLine="Dim rcexpo As Label";
mostCurrent._rcexpo = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 109;BA.debugLine="Dim rcrate As Label";
mostCurrent._rcrate = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 110;BA.debugLine="Dim throttleExpo As Label";
mostCurrent._throttleexpo = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 111;BA.debugLine="Dim throttleMid As Label";
mostCurrent._throttlemid = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 114;BA.debugLine="Dim labelsrc(8) As Label";
mostCurrent._labelsrc = new anywheresoftware.b4a.objects.LabelWrapper[(int)(8)];
{
int d0 = mostCurrent._labelsrc.length;
for (int i0 = 0;i0 < d0;i0++) {
mostCurrent._labelsrc[i0] = new anywheresoftware.b4a.objects.LabelWrapper();
}
}
;
 //BA.debugLineNum = 115;BA.debugLine="Dim labelsText(8) As String";
mostCurrent._labelstext = new String[(int)(8)];
java.util.Arrays.fill(mostCurrent._labelstext,"");
 //BA.debugLineNum = 116;BA.debugLine="labelsText=Array As String(\"Ail\",\"Ele\",\"Rud\",\"Thr\",\"Aux1\",\"Aux2\",\"Aux3\",\"Aux4\")";
mostCurrent._labelstext = new String[]{"Ail","Ele","Rud","Thr","Aux1","Aux2","Aux3","Aux4"};
 //BA.debugLineNum = 117;BA.debugLine="Dim radios(8) As ProgressBar";
mostCurrent._radios = new anywheresoftware.b4a.objects.ProgressBarWrapper[(int)(8)];
{
int d0 = mostCurrent._radios.length;
for (int i0 = 0;i0 < d0;i0++) {
mostCurrent._radios[i0] = new anywheresoftware.b4a.objects.ProgressBarWrapper();
}
}
;
 //BA.debugLineNum = 118;BA.debugLine="Dim motors(8) As ProgressBar";
mostCurrent._motors = new anywheresoftware.b4a.objects.ProgressBarWrapper[(int)(8)];
{
int d0 = mostCurrent._motors.length;
for (int i0 = 0;i0 < d0;i0++) {
mostCurrent._motors[i0] = new anywheresoftware.b4a.objects.ProgressBarWrapper();
}
}
;
 //BA.debugLineNum = 119;BA.debugLine="Dim start_rc As Button";
mostCurrent._start_rc = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 120;BA.debugLine="Dim start_motors As Button";
mostCurrent._start_motors = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 121;BA.debugLine="Dim rc_reading As Boolean";
_rc_reading = false;
 //BA.debugLineNum = 122;BA.debugLine="Dim gps_reading As Boolean";
_gps_reading = false;
 //BA.debugLineNum = 123;BA.debugLine="Dim motors_reading As Boolean";
_motors_reading = false;
 //BA.debugLineNum = 124;BA.debugLine="Dim sdi As SlidingData 'The object that holds the data for SlidingPanels";
mostCurrent._sdi = new slidingpanels._slidingdata();
 //BA.debugLineNum = 125;BA.debugLine="Dim SlidingDuration As Int";
_slidingduration = 0;
 //BA.debugLineNum = 126;BA.debugLine="Dim label_rcdata(8) As Label";
mostCurrent._label_rcdata = new anywheresoftware.b4a.objects.LabelWrapper[(int)(8)];
{
int d0 = mostCurrent._label_rcdata.length;
for (int i0 = 0;i0 < d0;i0++) {
mostCurrent._label_rcdata[i0] = new anywheresoftware.b4a.objects.LabelWrapper();
}
}
;
 //BA.debugLineNum = 127;BA.debugLine="Dim label_motordata(8) As Label";
mostCurrent._label_motordata = new anywheresoftware.b4a.objects.LabelWrapper[(int)(8)];
{
int d0 = mostCurrent._label_motordata.length;
for (int i0 = 0;i0 < d0;i0++) {
mostCurrent._label_motordata[i0] = new anywheresoftware.b4a.objects.LabelWrapper();
}
}
;
 //BA.debugLineNum = 128;BA.debugLine="SlidingDuration = 500";
_slidingduration = (int)(500);
 //BA.debugLineNum = 129;BA.debugLine="Dim startX, startY As Float";
_startx = 0f;
_starty = 0f;
 //BA.debugLineNum = 142;BA.debugLine="HeaderColor = Colors.Gray";
_headercolor = anywheresoftware.b4a.keywords.Common.Colors.Gray;
 //BA.debugLineNum = 143;BA.debugLine="NumberOfColumns = 4 'will be overwritten when loading from CSV file.";
_numberofcolumns = (int)(4);
 //BA.debugLineNum = 144;BA.debugLine="ColLineWidth = 1dip";
_collinewidth = anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(1));
 //BA.debugLineNum = 145;BA.debugLine="RowLineWidth = 1dip";
_rowlinewidth = anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(1));
 //BA.debugLineNum = 146;BA.debugLine="RowHeight_1 = 40dip";
_rowheight_1 = anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(40));
 //BA.debugLineNum = 147;BA.debugLine="RowHeight=RowHeight_1+RowLineWidth";
_rowheight = (int)(_rowheight_1+_rowlinewidth);
 //BA.debugLineNum = 148;BA.debugLine="LineColor = Colors.Black";
_linecolor = anywheresoftware.b4a.keywords.Common.Colors.Black;
 //BA.debugLineNum = 149;BA.debugLine="CellColor = Colors.White";
_cellcolor = anywheresoftware.b4a.keywords.Common.Colors.White;
 //BA.debugLineNum = 150;BA.debugLine="FontColor = Colors.Black";
_fontcolor = anywheresoftware.b4a.keywords.Common.Colors.Black;
 //BA.debugLineNum = 151;BA.debugLine="HeaderFontColor = Colors.White";
_headerfontcolor = anywheresoftware.b4a.keywords.Common.Colors.White;
 //BA.debugLineNum = 152;BA.debugLine="FontSize = 18";
_fontsize = (float)(18);
 //BA.debugLineNum = 153;BA.debugLine="Alignment = Gravity.CENTER 'change to Gravity.LEFT or Gravity.RIGHT for other alignments.";
_alignment = anywheresoftware.b4a.keywords.Common.Gravity.CENTER;
 //BA.debugLineNum = 156;BA.debugLine="Dim Read As Button";
mostCurrent._read = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 157;BA.debugLine="Dim Write As Button";
mostCurrent._write = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 160;BA.debugLine="Dim switchspanel As HorizontalScrollView";
mostCurrent._switchspanel = new anywheresoftware.b4a.objects.HorizontalScrollViewWrapper();
 //BA.debugLineNum = 161;BA.debugLine="Dim switchlabel(11) As Label";
mostCurrent._switchlabel = new anywheresoftware.b4a.objects.LabelWrapper[(int)(11)];
{
int d0 = mostCurrent._switchlabel.length;
for (int i0 = 0;i0 < d0;i0++) {
mostCurrent._switchlabel[i0] = new anywheresoftware.b4a.objects.LabelWrapper();
}
}
;
 //BA.debugLineNum = 162;BA.debugLine="Dim panellabel As Panel";
mostCurrent._panellabel = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 163;BA.debugLine="Dim panelswitch As HorizontalScrollView";
mostCurrent._panelswitch = new anywheresoftware.b4a.objects.HorizontalScrollViewWrapper();
 //BA.debugLineNum = 164;BA.debugLine="Dim checkbox_switch(11,12) As CheckBox";
mostCurrent._checkbox_switch = new anywheresoftware.b4a.objects.CompoundButtonWrapper.CheckBoxWrapper[(int)(11)][];
{
int d0 = mostCurrent._checkbox_switch.length;
int d1 = (int)(12);
for (int i0 = 0;i0 < d0;i0++) {
mostCurrent._checkbox_switch[i0] = new anywheresoftware.b4a.objects.CompoundButtonWrapper.CheckBoxWrapper[d1];
for (int i1 = 0;i1 < d1;i1++) {
mostCurrent._checkbox_switch[i0][i1] = new anywheresoftware.b4a.objects.CompoundButtonWrapper.CheckBoxWrapper();
}
}
}
;
 //BA.debugLineNum = 166;BA.debugLine="Dim gps_alt As Label";
mostCurrent._gps_alt = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 167;BA.debugLine="Dim gps_lat As Label";
mostCurrent._gps_lat = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 168;BA.debugLine="Dim gps_lon As Label";
mostCurrent._gps_lon = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 169;BA.debugLine="Dim gps_speed As Label";
mostCurrent._gps_speed = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 170;BA.debugLine="Dim gpsfix As Label";
mostCurrent._gpsfix = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 171;BA.debugLine="Dim gpsnumsat As Label";
mostCurrent._gpsnumsat = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 172;BA.debugLine="Dim googlemaps_button As Label";
mostCurrent._googlemaps_button = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 174;BA.debugLine="End Sub";
return "";
}
public static String  _googlemaps_button_click() throws Exception{
anywheresoftware.b4a.objects.IntentWrapper _mapintent = null;
String _geouri = "";
 //BA.debugLineNum = 1717;BA.debugLine="Sub googlemaps_button_Click";
 //BA.debugLineNum = 1718;BA.debugLine="Dim mapIntent As Intent";
_mapintent = new anywheresoftware.b4a.objects.IntentWrapper();
 //BA.debugLineNum = 1719;BA.debugLine="Dim geoURI As String";
_geouri = "";
 //BA.debugLineNum = 1720;BA.debugLine="geoURI=\"geo:0,0?q=\" & gps_lat.Text & \",\" & gps_lon.Text";
_geouri = "geo:0,0?q="+mostCurrent._gps_lat.getText()+","+mostCurrent._gps_lon.getText();
 //BA.debugLineNum = 1721;BA.debugLine="mapIntent.Initialize(mapIntent.ACTION_VIEW,geoURI)";
_mapintent.Initialize(_mapintent.ACTION_VIEW,_geouri);
 //BA.debugLineNum = 1723;BA.debugLine="StartActivity(mapIntent)";
anywheresoftware.b4a.keywords.Common.StartActivity(mostCurrent.activityBA,(Object)(_mapintent.getObject()));
 //BA.debugLineNum = 1724;BA.debugLine="End Sub";
return "";
}
public static String  _header_click() throws Exception{
anywheresoftware.b4a.objects.LabelWrapper _l = null;
int _col = 0;
 //BA.debugLineNum = 903;BA.debugLine="Sub Header_Click";
 //BA.debugLineNum = 904;BA.debugLine="Dim l As Label";
_l = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 905;BA.debugLine="Dim col As Int";
_col = 0;
 //BA.debugLineNum = 906;BA.debugLine="l = Sender";
_l.setObject((android.widget.TextView)(anywheresoftware.b4a.keywords.Common.Sender(mostCurrent.activityBA)));
 //BA.debugLineNum = 907;BA.debugLine="col = l.Tag";
_col = (int)(BA.ObjectToNumber(_l.getTag()));
 //BA.debugLineNum = 909;BA.debugLine="End Sub";
return "";
}
public static String  _jumptopanel(int _target) throws Exception{
int _i = 0;
 //BA.debugLineNum = 1682;BA.debugLine="Sub JumpToPanel (Target As Int)";
 //BA.debugLineNum = 1683;BA.debugLine="sdi.targetPanel = Target";
mostCurrent._sdi.targetPanel = _target;
 //BA.debugLineNum = 1684;BA.debugLine="For i = 0 To 1";
{
final double step1392 = 1;
final double limit1392 = (int)(1);
for (_i = (int)(0); (step1392 > 0 && _i <= limit1392) || (step1392 < 0 && _i >= limit1392); _i += step1392) {
 //BA.debugLineNum = 1685;BA.debugLine="sdi.leftAnimations(i).Duration = SlidingDuration / 2";
mostCurrent._sdi.LeftAnimations[_i].setDuration((long)(_slidingduration/(double)2));
 //BA.debugLineNum = 1686;BA.debugLine="sdi.rightAnimations(i).Duration = SlidingDuration / 2";
mostCurrent._sdi.RightAnimations[_i].setDuration((long)(_slidingduration/(double)2));
 }
};
 //BA.debugLineNum = 1688;BA.debugLine="ContinueJumping";
_continuejumping();
 //BA.debugLineNum = 1689;BA.debugLine="End Sub";
return "";
}
public static String  _main_tabhost1_tabchanged() throws Exception{
 //BA.debugLineNum = 1467;BA.debugLine="Sub main_TabHost1_TabChanged";
 //BA.debugLineNum = 1468;BA.debugLine="CurrentTab=main_TabHost1.CurrentTab";
_currenttab = mostCurrent._main_tabhost1.getCurrentTab();
 //BA.debugLineNum = 1469;BA.debugLine="If connected Then";
if (_connected) { 
 //BA.debugLineNum = 1470;BA.debugLine="read_Click";
_read_click();
 };
 //BA.debugLineNum = 1472;BA.debugLine="End Sub";
return "";
}
public static int  _numberofrows() throws Exception{
 //BA.debugLineNum = 961;BA.debugLine="Sub NumberOfRows As Int";
 //BA.debugLineNum = 962;BA.debugLine="Return Table.NumberOfViews / NumberOfColumns";
if (true) return (int)(mostCurrent._table.getNumberOfViews()/(double)_numberofcolumns);
 //BA.debugLineNum = 963;BA.debugLine="End Sub";
return 0;
}
public static String  _panels_touch(int _action,float _x,float _y) throws Exception{
 //BA.debugLineNum = 1702;BA.debugLine="Sub Panels_Touch (Action As Int, X As Float, Y As Float)";
 //BA.debugLineNum = 1703;BA.debugLine="Select Action";
switch (BA.switchObjectToInt(_action,mostCurrent._activity.ACTION_DOWN,mostCurrent._activity.ACTION_UP)) {
case 0:
 //BA.debugLineNum = 1705;BA.debugLine="startX = X";
_startx = _x;
 //BA.debugLineNum = 1706;BA.debugLine="startY = Y";
_starty = _y;
 break;
case 1:
 //BA.debugLineNum = 1708;BA.debugLine="If Abs(Y - startY) > 20%y Then Return";
if (anywheresoftware.b4a.keywords.Common.Abs(_y-_starty)>anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(20),mostCurrent.activityBA)) { 
if (true) return "";};
 //BA.debugLineNum = 1709;BA.debugLine="If X - startX > 30%x Then";
if (_x-_startx>anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(30),mostCurrent.activityBA)) { 
 //BA.debugLineNum = 1710;BA.debugLine="ChangePanel(False)";
_changepanel(anywheresoftware.b4a.keywords.Common.False);
 }else if(_startx-_x>anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(30),mostCurrent.activityBA)) { 
 //BA.debugLineNum = 1712;BA.debugLine="ChangePanel(True)";
_changepanel(anywheresoftware.b4a.keywords.Common.True);
 };
 break;
}
;
 //BA.debugLineNum = 1715;BA.debugLine="End Sub";
return "";
}
public static String  _popup(int _inicial,int _quien) throws Exception{
anywheresoftware.b4a.objects.PanelWrapper _pnl = null;
anywheresoftware.b4a.objects.drawable.ColorDrawable _bgnd = null;
String _a = "";
String _ret = "";
byte[] _arr = null;
int _i = 0;
String _texttosend = "";
 //BA.debugLineNum = 727;BA.debugLine="Sub popup(inicial As Int, quien As Int)";
 //BA.debugLineNum = 728;BA.debugLine="Dim pnl As Panel";
_pnl = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 729;BA.debugLine="pnl.Initialize(\"pnl\")";
_pnl.Initialize(mostCurrent.activityBA,"pnl");
 //BA.debugLineNum = 730;BA.debugLine="Dim bgnd As ColorDrawable";
_bgnd = new anywheresoftware.b4a.objects.drawable.ColorDrawable();
 //BA.debugLineNum = 731;BA.debugLine="bgnd.Initialize(Colors.Black, 5dip)";
_bgnd.Initialize(anywheresoftware.b4a.keywords.Common.Colors.Black,anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(5)));
 //BA.debugLineNum = 732;BA.debugLine="pnl.Background = bgnd";
_pnl.setBackground((android.graphics.drawable.Drawable)(_bgnd.getObject()));
 //BA.debugLineNum = 736;BA.debugLine="lbl2.Initialize(\"lbl2\")";
mostCurrent._lbl2.Initialize(mostCurrent.activityBA,"lbl2");
 //BA.debugLineNum = 737;BA.debugLine="sk1.Initialize(\"sk1\")";
mostCurrent._sk1.Initialize(mostCurrent.activityBA,"sk1");
 //BA.debugLineNum = 738;BA.debugLine="lbl2.Text=inicial";
mostCurrent._lbl2.setText((Object)(_inicial));
 //BA.debugLineNum = 739;BA.debugLine="sk1.Value=inicial";
mostCurrent._sk1.setValue(_inicial);
 //BA.debugLineNum = 740;BA.debugLine="pnl.AddView(sk1,5%x,10%y,70%x,35dip)";
_pnl.AddView((android.view.View)(mostCurrent._sk1.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(5),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(70),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(35)));
 //BA.debugLineNum = 741;BA.debugLine="lbl2.Gravity=Gravity.CENTER";
mostCurrent._lbl2.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 742;BA.debugLine="pnl.AddView(lbl2,20%x,0%y,20%x,30dip)";
_pnl.AddView((android.view.View)(mostCurrent._lbl2.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(20),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(0),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(20),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.DipToCurrent((int)(30)));
 //BA.debugLineNum = 744;BA.debugLine="cd.AddView(pnl, 0%x, 0%y, 80%x, 30%y) ' sizing relative to the screen size is probably best";
mostCurrent._cd.AddView((android.view.View)(_pnl.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(0),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(0),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(80),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(30),mostCurrent.activityBA));
 //BA.debugLineNum = 745;BA.debugLine="a= pnl.Width/2-lbl2.Width/2";
_a = BA.NumberToString(_pnl.getWidth()/(double)2-mostCurrent._lbl2.getWidth()/(double)2);
 //BA.debugLineNum = 747;BA.debugLine="lbl2.Left=a";
mostCurrent._lbl2.setLeft((int)(Double.parseDouble(_a)));
 //BA.debugLineNum = 748;BA.debugLine="ret = cd.Show(\"\", \"Ok\", \"Cancel\", \"\", Null)";
_ret = BA.NumberToString(mostCurrent._cd.Show("","Ok","Cancel","",mostCurrent.activityBA,(android.graphics.Bitmap)(anywheresoftware.b4a.keywords.Common.Null)));
 //BA.debugLineNum = 749;BA.debugLine="If ret=DialogResponse.POSITIVE Then";
if ((_ret).equals(BA.NumberToString(anywheresoftware.b4a.keywords.Common.DialogResponse.POSITIVE))) { 
 //BA.debugLineNum = 750;BA.debugLine="Select quien";
switch (_quien) {
case 0:
 //BA.debugLineNum = 751;BA.debugLine="Case 0:	RollPitchRate.Text=valor/100";
mostCurrent._rollpitchrate.setText((Object)(_valor/(double)100));
 break;
case 1:
 //BA.debugLineNum = 752;BA.debugLine="Case 1:YawRate.Text=valor/100";
mostCurrent._yawrate.setText((Object)(_valor/(double)100));
 break;
case 2:
 //BA.debugLineNum = 753;BA.debugLine="Case 2:ThrottlePidAtt.Text=valor/100";
mostCurrent._throttlepidatt.setText((Object)(_valor/(double)100));
 break;
case 3:
 //BA.debugLineNum = 754;BA.debugLine="Case 3:rcexpo.Text=valor/100";
mostCurrent._rcexpo.setText((Object)(_valor/(double)100));
 break;
case 4:
 //BA.debugLineNum = 755;BA.debugLine="Case 4:rcrate.Text=valor/100";
mostCurrent._rcrate.setText((Object)(_valor/(double)100));
 break;
case 5:
 //BA.debugLineNum = 756;BA.debugLine="Case 5:throttleMid.Text=valor/100";
mostCurrent._throttlemid.setText((Object)(_valor/(double)100));
 break;
case 6:
 //BA.debugLineNum = 757;BA.debugLine="Case 6:throttleExpo.Text=valor/100";
mostCurrent._throttleexpo.setText((Object)(_valor/(double)100));
 break;
}
;
 //BA.debugLineNum = 760;BA.debugLine="checksum=0";
_checksum = (byte)(0);
 //BA.debugLineNum = 761;BA.debugLine="Dim arr(100) As Byte";
_arr = new byte[(int)(100)];
;
 //BA.debugLineNum = 762;BA.debugLine="arr(0)= Asc(\"$\")";
_arr[(int)(0)] = (byte)(anywheresoftware.b4a.keywords.Common.Asc(BA.ObjectToChar("$")));
 //BA.debugLineNum = 763;BA.debugLine="arr(1)=Asc(\"M\")";
_arr[(int)(1)] = (byte)(anywheresoftware.b4a.keywords.Common.Asc(BA.ObjectToChar("M")));
 //BA.debugLineNum = 764;BA.debugLine="arr(2)=Asc(\"<\")";
_arr[(int)(2)] = (byte)(anywheresoftware.b4a.keywords.Common.Asc(BA.ObjectToChar("<")));
 //BA.debugLineNum = 765;BA.debugLine="arr(3)=7";
_arr[(int)(3)] = (byte)(7);
 //BA.debugLineNum = 766;BA.debugLine="arr(4)=MSP_SET_RC_TUNING";
_arr[(int)(4)] = (byte)(Double.parseDouble(_msp_set_rc_tuning));
 //BA.debugLineNum = 767;BA.debugLine="arr(5)= (rcrate.text * 100)";
_arr[(int)(5)] = (byte)(((double)(Double.parseDouble(mostCurrent._rcrate.getText()))*100));
 //BA.debugLineNum = 768;BA.debugLine="arr(6) = rcexpo.text * 100";
_arr[(int)(6)] = (byte)((double)(Double.parseDouble(mostCurrent._rcexpo.getText()))*100);
 //BA.debugLineNum = 769;BA.debugLine="arr(7)= (RollPitchRate.text * 100)";
_arr[(int)(7)] = (byte)(((double)(Double.parseDouble(mostCurrent._rollpitchrate.getText()))*100));
 //BA.debugLineNum = 770;BA.debugLine="arr(8)=(YawRate.text * 100)";
_arr[(int)(8)] = (byte)(((double)(Double.parseDouble(mostCurrent._yawrate.getText()))*100));
 //BA.debugLineNum = 771;BA.debugLine="arr(9)= (ThrottlePidAtt.text * 100)";
_arr[(int)(9)] = (byte)(((double)(Double.parseDouble(mostCurrent._throttlepidatt.getText()))*100));
 //BA.debugLineNum = 772;BA.debugLine="arr(10)= (throttleMid.Text*100)";
_arr[(int)(10)] = (byte)(((double)(Double.parseDouble(mostCurrent._throttlemid.getText()))*100));
 //BA.debugLineNum = 773;BA.debugLine="arr(11)= (throttleExpo.Text*100)";
_arr[(int)(11)] = (byte)(((double)(Double.parseDouble(mostCurrent._throttleexpo.getText()))*100));
 //BA.debugLineNum = 774;BA.debugLine="For i= 5 To 11";
{
final double step620 = 1;
final double limit620 = (int)(11);
for (_i = (int)(5); (step620 > 0 && _i <= limit620) || (step620 < 0 && _i >= limit620); _i += step620) {
 //BA.debugLineNum = 775;BA.debugLine="checksum =Bit.Xor(checksum,arr(i))";
_checksum = (byte)(anywheresoftware.b4a.keywords.Common.Bit.Xor((int)(_checksum),(int)(_arr[_i])));
 }
};
 //BA.debugLineNum = 777;BA.debugLine="arr(12)=checksum";
_arr[(int)(12)] = _checksum;
 //BA.debugLineNum = 778;BA.debugLine="Dim textToSend As String";
_texttosend = "";
 //BA.debugLineNum = 779;BA.debugLine="textToSend=converter.StringFromBytes(arr,\"ISO-8859-1\")";
_texttosend = _converter.StringFromBytes(_arr,"ISO-8859-1");
 //BA.debugLineNum = 780;BA.debugLine="TextWriter1.Write(textToSend)";
_textwriter1.Write(_texttosend);
 //BA.debugLineNum = 781;BA.debugLine="TextWriter1.flush";
_textwriter1.Flush();
 };
 //BA.debugLineNum = 785;BA.debugLine="End Sub";
return "";
}
public static String  _process_globals() throws Exception{
 //BA.debugLineNum = 1;BA.debugLine="Sub Process_Globals";
 //BA.debugLineNum = 2;BA.debugLine="Dim admin As BluetoothAdmin";
_admin = new anywheresoftware.b4a.objects.Serial.BluetoothAdmin();
 //BA.debugLineNum = 3;BA.debugLine="Dim serial1 As Serial";
_serial1 = new anywheresoftware.b4a.objects.Serial();
 //BA.debugLineNum = 4;BA.debugLine="Dim TextReader1 As TextReader";
_textreader1 = new anywheresoftware.b4a.objects.streams.File.TextReaderWrapper();
 //BA.debugLineNum = 5;BA.debugLine="Dim TextWriter1 As TextWriter";
_textwriter1 = new anywheresoftware.b4a.objects.streams.File.TextWriterWrapper();
 //BA.debugLineNum = 6;BA.debugLine="Dim Timer1 As Timer";
_timer1 = new anywheresoftware.b4a.objects.Timer();
 //BA.debugLineNum = 7;BA.debugLine="Dim connected As Boolean";
_connected = false;
 //BA.debugLineNum = 8;BA.debugLine="Dim buffer(155) As Char";
_buffer = new char[(int)(155)];
;
 //BA.debugLineNum = 9;BA.debugLine="Dim converter As ByteConverter";
_converter = new anywheresoftware.b4a.agraham.byteconverter.ByteConverter();
 //BA.debugLineNum = 10;BA.debugLine="Dim foundDevices As List";
_founddevices = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 11;BA.debugLine="Type NameAndMac (Name As String, Mac As String)";
;
 //BA.debugLineNum = 12;BA.debugLine="Dim connectedDevice As NameAndMac";
_connecteddevice = new main._nameandmac();
 //BA.debugLineNum = 13;BA.debugLine="Dim converter As ByteConverter";
_converter = new anywheresoftware.b4a.agraham.byteconverter.ByteConverter();
 //BA.debugLineNum = 14;BA.debugLine="Dim last_buffer_size As Int";
_last_buffer_size = 0;
 //BA.debugLineNum = 15;BA.debugLine="Dim return_from_cli As Boolean";
_return_from_cli = false;
 //BA.debugLineNum = 16;BA.debugLine="Dim tmrAnimation As Timer";
_tmranimation = new anywheresoftware.b4a.objects.Timer();
 //BA.debugLineNum = 17;BA.debugLine="Dim currentPanelBeforePaused As Int";
_currentpanelbeforepaused = 0;
 //BA.debugLineNum = 18;BA.debugLine="Dim connected_device As String";
_connected_device = "";
 //BA.debugLineNum = 19;BA.debugLine="Dim protocol As Int";
_protocol = 0;
 //BA.debugLineNum = 20;BA.debugLine="Dim CurrentTab As Int";
_currenttab = 0;
 //BA.debugLineNum = 21;BA.debugLine="Dim MSP_IDENT, MSP_STATUS,MSP_RAW_IMU  , MSP_SERVO ,MSP_MOTOR ,MSP_RC ,MSP_RAW_GPS ,MSP_COMP_GPS       ,MSP_ATTITUDE       ,MSP_ALTITUDE       ,MSP_BAT            ,MSP_RC_TUNING      ,MSP_PID            ,MSP_BOX            ,MSP_MISC           ,MSP_SET_RAW_RC     ,MSP_SET_RAW_GPS    ,MSP_SET_PID        ,MSP_SET_BOX        ,MSP_SET_RC_TUNING  ,MSP_ACC_CALIBRATION,MSP_MAG_CALIBRATION,MSP_SET_MISC       ,MSP_RESET_CONF     ,MSP_EEPROM_WRITE   ,MSP_DEBUG";
_msp_ident = "";
_msp_status = "";
_msp_raw_imu = "";
_msp_servo = "";
_msp_motor = "";
_msp_rc = "";
_msp_raw_gps = "";
_msp_comp_gps = "";
_msp_attitude = "";
_msp_altitude = "";
_msp_bat = "";
_msp_rc_tuning = "";
_msp_pid = "";
_msp_box = "";
_msp_misc = "";
_msp_set_raw_rc = "";
_msp_set_raw_gps = "";
_msp_set_pid = "";
_msp_set_box = "";
_msp_set_rc_tuning = "";
_msp_acc_calibration = "";
_msp_mag_calibration = "";
_msp_set_misc = "";
_msp_reset_conf = "";
_msp_eeprom_write = "";
_msp_debug = "";
 //BA.debugLineNum = 22;BA.debugLine="MSP_IDENT                =100";
_msp_ident = BA.NumberToString(100);
 //BA.debugLineNum = 23;BA.debugLine="MSP_STATUS               =101";
_msp_status = BA.NumberToString(101);
 //BA.debugLineNum = 24;BA.debugLine="MSP_RAW_IMU              =102";
_msp_raw_imu = BA.NumberToString(102);
 //BA.debugLineNum = 25;BA.debugLine="MSP_SERVO                =103";
_msp_servo = BA.NumberToString(103);
 //BA.debugLineNum = 26;BA.debugLine="MSP_MOTOR                =104";
_msp_motor = BA.NumberToString(104);
 //BA.debugLineNum = 27;BA.debugLine="MSP_RC                   =105";
_msp_rc = BA.NumberToString(105);
 //BA.debugLineNum = 28;BA.debugLine="MSP_RAW_GPS              =106";
_msp_raw_gps = BA.NumberToString(106);
 //BA.debugLineNum = 29;BA.debugLine="MSP_COMP_GPS             =107";
_msp_comp_gps = BA.NumberToString(107);
 //BA.debugLineNum = 30;BA.debugLine="MSP_ATTITUDE             =108";
_msp_attitude = BA.NumberToString(108);
 //BA.debugLineNum = 31;BA.debugLine="MSP_ALTITUDE             =109";
_msp_altitude = BA.NumberToString(109);
 //BA.debugLineNum = 32;BA.debugLine="MSP_BAT                  =110";
_msp_bat = BA.NumberToString(110);
 //BA.debugLineNum = 33;BA.debugLine="MSP_RC_TUNING            =111";
_msp_rc_tuning = BA.NumberToString(111);
 //BA.debugLineNum = 34;BA.debugLine="MSP_PID                  =112";
_msp_pid = BA.NumberToString(112);
 //BA.debugLineNum = 35;BA.debugLine="MSP_BOX                  =113";
_msp_box = BA.NumberToString(113);
 //BA.debugLineNum = 36;BA.debugLine="MSP_MISC                 =114";
_msp_misc = BA.NumberToString(114);
 //BA.debugLineNum = 37;BA.debugLine="MSP_SET_RAW_RC           =200";
_msp_set_raw_rc = BA.NumberToString(200);
 //BA.debugLineNum = 38;BA.debugLine="MSP_SET_RAW_GPS          =201";
_msp_set_raw_gps = BA.NumberToString(201);
 //BA.debugLineNum = 39;BA.debugLine="MSP_SET_PID              =202";
_msp_set_pid = BA.NumberToString(202);
 //BA.debugLineNum = 40;BA.debugLine="MSP_SET_BOX              =203";
_msp_set_box = BA.NumberToString(203);
 //BA.debugLineNum = 41;BA.debugLine="MSP_SET_RC_TUNING        =204";
_msp_set_rc_tuning = BA.NumberToString(204);
 //BA.debugLineNum = 42;BA.debugLine="MSP_ACC_CALIBRATION      =205";
_msp_acc_calibration = BA.NumberToString(205);
 //BA.debugLineNum = 43;BA.debugLine="MSP_MAG_CALIBRATION      =206";
_msp_mag_calibration = BA.NumberToString(206);
 //BA.debugLineNum = 44;BA.debugLine="MSP_SET_MISC             =207";
_msp_set_misc = BA.NumberToString(207);
 //BA.debugLineNum = 45;BA.debugLine="MSP_RESET_CONF           =208";
_msp_reset_conf = BA.NumberToString(208);
 //BA.debugLineNum = 46;BA.debugLine="MSP_EEPROM_WRITE         =250";
_msp_eeprom_write = BA.NumberToString(250);
 //BA.debugLineNum = 47;BA.debugLine="MSP_DEBUG                =254";
_msp_debug = BA.NumberToString(254);
 //BA.debugLineNum = 48;BA.debugLine="Dim stateMSP,offset,dataSize,indTX As Int";
_statemsp = 0;
_offset = 0;
_datasize = 0;
_indtx = 0;
 //BA.debugLineNum = 49;BA.debugLine="checksum=0";
_checksum = (byte)(0);
 //BA.debugLineNum = 50;BA.debugLine="stateMSP=0";
_statemsp = (int)(0);
 //BA.debugLineNum = 51;BA.debugLine="offset=0";
_offset = (int)(0);
 //BA.debugLineNum = 52;BA.debugLine="dataSize=0";
_datasize = (int)(0);
 //BA.debugLineNum = 53;BA.debugLine="indTX=0";
_indtx = (int)(0);
 //BA.debugLineNum = 54;BA.debugLine="Dim checksum As Byte";
_checksum = 0;
 //BA.debugLineNum = 55;BA.debugLine="End Sub";
return "";
}
public static String  _rcexpo_click() throws Exception{
 //BA.debugLineNum = 678;BA.debugLine="Sub rcexpo_Click";
 //BA.debugLineNum = 679;BA.debugLine="what_col=11";
_what_col = (int)(11);
 //BA.debugLineNum = 680;BA.debugLine="popup(rcexpo.Text*100,3)";
_popup((int)((double)(Double.parseDouble(mostCurrent._rcexpo.getText()))*100),(int)(3));
 //BA.debugLineNum = 682;BA.debugLine="End Sub";
return "";
}
public static String  _rcrate_click() throws Exception{
 //BA.debugLineNum = 683;BA.debugLine="Sub rcrate_Click";
 //BA.debugLineNum = 684;BA.debugLine="what_col=10";
_what_col = (int)(10);
 //BA.debugLineNum = 685;BA.debugLine="popup(rcrate.Text*100,4)";
_popup((int)((double)(Double.parseDouble(mostCurrent._rcrate.getText()))*100),(int)(4));
 //BA.debugLineNum = 687;BA.debugLine="End Sub";
return "";
}
public static String  _read_click() throws Exception{
 //BA.debugLineNum = 1448;BA.debugLine="Sub read_Click";
 //BA.debugLineNum = 1449;BA.debugLine="If protocol=0 Then";
if (_protocol==0) { 
 //BA.debugLineNum = 1450;BA.debugLine="TextWriter1.Write(\"M\")";
_textwriter1.Write("M");
 //BA.debugLineNum = 1451;BA.debugLine="TextWriter1.Flush";
_textwriter1.Flush();
 }else {
 //BA.debugLineNum = 1453;BA.debugLine="Select CurrentTab";
switch (_currenttab) {
case 0:
 //BA.debugLineNum = 1455;BA.debugLine="TextWriter1.Write(\"$M<\" & Chr(MSP_PID))";
_textwriter1.Write("$M<"+String.valueOf(anywheresoftware.b4a.keywords.Common.Chr((int)(Double.parseDouble(_msp_pid)))));
 //BA.debugLineNum = 1456;BA.debugLine="TextWriter1.Flush";
_textwriter1.Flush();
 break;
case 1:
 //BA.debugLineNum = 1458;BA.debugLine="TextWriter1.Write(\"$M<\" & Chr(MSP_RC_TUNING))";
_textwriter1.Write("$M<"+String.valueOf(anywheresoftware.b4a.keywords.Common.Chr((int)(Double.parseDouble(_msp_rc_tuning)))));
 //BA.debugLineNum = 1459;BA.debugLine="TextWriter1.Flush";
_textwriter1.Flush();
 break;
case 2:
 //BA.debugLineNum = 1461;BA.debugLine="TextWriter1.Write(\"$M<\" & Chr(MSP_BOX))";
_textwriter1.Write("$M<"+String.valueOf(anywheresoftware.b4a.keywords.Common.Chr((int)(Double.parseDouble(_msp_box)))));
 //BA.debugLineNum = 1462;BA.debugLine="TextWriter1.Flush";
_textwriter1.Flush();
 break;
}
;
 };
 //BA.debugLineNum = 1466;BA.debugLine="End Sub";
return "";
}
public static int  _read16(int _b,int _c) throws Exception{
 //BA.debugLineNum = 1297;BA.debugLine="Sub read16(b As Int, c As Int) As Int";
 //BA.debugLineNum = 1298;BA.debugLine="Return Bit.And(b,0xFF) + Bit.ShiftLeft(Bit.And(c,0xFF),8)";
if (true) return (int)(anywheresoftware.b4a.keywords.Common.Bit.And(_b,(int)(0xff))+anywheresoftware.b4a.keywords.Common.Bit.ShiftLeft(anywheresoftware.b4a.keywords.Common.Bit.And(_c,(int)(0xff)),(int)(8)));
 //BA.debugLineNum = 1299;BA.debugLine="End Sub";
return 0;
}
public static int  _read32(int _b,int _c) throws Exception{
 //BA.debugLineNum = 1300;BA.debugLine="Sub read32(b As Int, c As Int) As Int";
 //BA.debugLineNum = 1301;BA.debugLine="Return Bit.and(b,0xffff) + Bit.ShiftLeft(Bit.And(c,0xffff),16)";
if (true) return (int)(anywheresoftware.b4a.keywords.Common.Bit.And(_b,(int)(0xffff))+anywheresoftware.b4a.keywords.Common.Bit.ShiftLeft(anywheresoftware.b4a.keywords.Common.Bit.And(_c,(int)(0xffff)),(int)(16)));
 //BA.debugLineNum = 1302;BA.debugLine="End Sub";
return 0;
}
public static int  _read8(int _b) throws Exception{
 //BA.debugLineNum = 1294;BA.debugLine="Sub read8(b As Int) As Int";
 //BA.debugLineNum = 1295;BA.debugLine="Return Bit.And(b, 0xFF)";
if (true) return anywheresoftware.b4a.keywords.Common.Bit.And(_b,(int)(0xff));
 //BA.debugLineNum = 1296;BA.debugLine="End Sub";
return 0;
}
public static String  _readdata_click() throws Exception{
String _fi = "";
anywheresoftware.b4a.agraham.dialogs.InputDialog.FileDialog _fd = null;
int _ret = 0;
anywheresoftware.b4a.objects.streams.File.TextReaderWrapper _tr = null;
anywheresoftware.b4a.objects.collections.List _listdata = null;
String _line = "";
int _i = 0;
int[] _act1 = null;
int[] _act2 = null;
int _row = 0;
String _a1 = "";
String _a2 = "";
 //BA.debugLineNum = 562;BA.debugLine="Sub readdata_Click";
 //BA.debugLineNum = 563;BA.debugLine="Dim fi As String";
_fi = "";
 //BA.debugLineNum = 564;BA.debugLine="Dim fd As FileDialog";
_fd = new anywheresoftware.b4a.agraham.dialogs.InputDialog.FileDialog();
 //BA.debugLineNum = 565;BA.debugLine="Dim ret As Int";
_ret = 0;
 //BA.debugLineNum = 567;BA.debugLine="File.MakeDir(\"/mnt/sdcard\",\"nazecontrol\")";
anywheresoftware.b4a.keywords.Common.File.MakeDir("/mnt/sdcard","nazecontrol");
 //BA.debugLineNum = 568;BA.debugLine="fd.FilePath=\"/mnt/sdcard/nazecontrol\"";
_fd.setFilePath("/mnt/sdcard/nazecontrol");
 //BA.debugLineNum = 569;BA.debugLine="fd.FileFilter=\"naz\"";
_fd.setFileFilter("naz");
 //BA.debugLineNum = 570;BA.debugLine="If File.Exists(fd.FilePath, fi) = True Then";
if (anywheresoftware.b4a.keywords.Common.File.Exists(_fd.getFilePath(),_fi)==anywheresoftware.b4a.keywords.Common.True) { 
 //BA.debugLineNum = 572;BA.debugLine="ret = fd.Show(\"Read\" & fi, \"Read\",\"\",\"Cancel\", Null)";
_ret = _fd.Show("Read"+_fi,"Read","","Cancel",mostCurrent.activityBA,(android.graphics.Bitmap)(anywheresoftware.b4a.keywords.Common.Null));
 //BA.debugLineNum = 573;BA.debugLine="If ret = -2 Then";
if (_ret==-2) { 
 //BA.debugLineNum = 574;BA.debugLine="Return ' \"Don't save\" was pressed.";
if (true) return "";
 }else {
 //BA.debugLineNum = 576;BA.debugLine="Dim TR As TextReader";
_tr = new anywheresoftware.b4a.objects.streams.File.TextReaderWrapper();
 //BA.debugLineNum = 577;BA.debugLine="TR.Initialize(File.OpenInput(fd.FilePath, fd.ChosenName))";
_tr.Initialize((java.io.InputStream)(anywheresoftware.b4a.keywords.Common.File.OpenInput(_fd.getFilePath(),_fd.getChosenName()).getObject()));
 //BA.debugLineNum = 578;BA.debugLine="Dim listdata As List";
_listdata = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 579;BA.debugLine="listdata.Initialize";
_listdata.Initialize();
 //BA.debugLineNum = 580;BA.debugLine="Dim line As String";
_line = "";
 //BA.debugLineNum = 581;BA.debugLine="line = TR.ReadLine";
_line = _tr.ReadLine();
 //BA.debugLineNum = 582;BA.debugLine="Do While line <> Null";
while (_line!= null) {
 //BA.debugLineNum = 583;BA.debugLine="listdata.add(line)";
_listdata.Add((Object)(_line));
 //BA.debugLineNum = 584;BA.debugLine="line=TR.ReadLine";
_line = _tr.ReadLine();
 }
;
 //BA.debugLineNum = 587;BA.debugLine="For i=0 To 5";
{
final double step456 = 1;
final double limit456 = (int)(5);
for (_i = (int)(0); (step456 > 0 && _i <= limit456) || (step456 < 0 && _i >= limit456); _i += step456) {
 //BA.debugLineNum = 588;BA.debugLine="SetCell(i,1,listdata.Get(3*i)/10) 'P";
_setcell(_i,(int)(1),BA.NumberToString((double)(BA.ObjectToNumber(_listdata.Get((int)(3*_i))))/(double)10));
 //BA.debugLineNum = 589;BA.debugLine="SetCell(i,2,listdata.Get(3*i+1)/1000) 'I";
_setcell(_i,(int)(2),BA.NumberToString((double)(BA.ObjectToNumber(_listdata.Get((int)(3*_i+1))))/(double)1000));
 //BA.debugLineNum = 590;BA.debugLine="SetCell(i,3,listdata.Get(3*i+2)) 'D";
_setcell(_i,(int)(3),String.valueOf(_listdata.Get((int)(3*_i+2))));
 }
};
 //BA.debugLineNum = 593;BA.debugLine="SetCell(6,1,listdata.Get(18)/10) 'mag P";
_setcell((int)(6),(int)(1),BA.NumberToString((double)(BA.ObjectToNumber(_listdata.Get((int)(18))))/(double)10));
 //BA.debugLineNum = 594;BA.debugLine="rcrate.Text=listdata.Get(19)/100";
mostCurrent._rcrate.setText((Object)((double)(BA.ObjectToNumber(_listdata.Get((int)(19))))/(double)100));
 //BA.debugLineNum = 595;BA.debugLine="rcexpo.Text=listdata.Get(20)/100";
mostCurrent._rcexpo.setText((Object)((double)(BA.ObjectToNumber(_listdata.Get((int)(20))))/(double)100));
 //BA.debugLineNum = 596;BA.debugLine="RollPitchRate.Text=listdata.Get(21)/100";
mostCurrent._rollpitchrate.setText((Object)((double)(BA.ObjectToNumber(_listdata.Get((int)(21))))/(double)100));
 //BA.debugLineNum = 597;BA.debugLine="YawRate.Text=listdata.Get(22)/100";
mostCurrent._yawrate.setText((Object)((double)(BA.ObjectToNumber(_listdata.Get((int)(22))))/(double)100));
 //BA.debugLineNum = 598;BA.debugLine="ThrottlePidAtt.Text=listdata.Get(23)/100";
mostCurrent._throttlepidatt.setText((Object)((double)(BA.ObjectToNumber(_listdata.Get((int)(23))))/(double)100));
 //BA.debugLineNum = 600;BA.debugLine="Dim act1(30) As Int";
_act1 = new int[(int)(30)];
;
 //BA.debugLineNum = 601;BA.debugLine="Dim act2(30) As Int";
_act2 = new int[(int)(30)];
;
 //BA.debugLineNum = 602;BA.debugLine="For i=0 To 10";
{
final double step469 = 1;
final double limit469 = (int)(10);
for (_i = (int)(0); (step469 > 0 && _i <= limit469) || (step469 < 0 && _i >= limit469); _i += step469) {
 //BA.debugLineNum = 603;BA.debugLine="act1(i)=listdata.Get(24+2*i)";
_act1[_i] = (int)(BA.ObjectToNumber(_listdata.Get((int)(24+2*_i))));
 //BA.debugLineNum = 604;BA.debugLine="act2(i)=listdata.Get(25+2*i)";
_act2[_i] = (int)(BA.ObjectToNumber(_listdata.Get((int)(25+2*_i))));
 }
};
 //BA.debugLineNum = 606;BA.debugLine="For row=0 To 10";
{
final double step473 = 1;
final double limit473 = (int)(10);
for (_row = (int)(0); (step473 > 0 && _row <= limit473) || (step473 < 0 && _row >= limit473); _row += step473) {
 //BA.debugLineNum = 607;BA.debugLine="Dim a1,a2 As String";
_a1 = "";
_a2 = "";
 //BA.debugLineNum = 608;BA.debugLine="a1=Bit.ToBinaryString(act1(row))";
_a1 = anywheresoftware.b4a.keywords.Common.Bit.ToBinaryString(_act1[_row]);
 //BA.debugLineNum = 609;BA.debugLine="a2=Bit.ToBinaryString(act2(row))";
_a2 = anywheresoftware.b4a.keywords.Common.Bit.ToBinaryString(_act2[_row]);
 //BA.debugLineNum = 611;BA.debugLine="For i=a1.Length To 7";
{
final double step477 = 1;
final double limit477 = (int)(7);
for (_i = _a1.length(); (step477 > 0 && _i <= limit477) || (step477 < 0 && _i >= limit477); _i += step477) {
 //BA.debugLineNum = 612;BA.debugLine="a1=\"0\" & a1";
_a1 = "0"+_a1;
 }
};
 //BA.debugLineNum = 614;BA.debugLine="For i=a2.Length To 7";
{
final double step480 = 1;
final double limit480 = (int)(7);
for (_i = _a2.length(); (step480 > 0 && _i <= limit480) || (step480 < 0 && _i >= limit480); _i += step480) {
 //BA.debugLineNum = 615;BA.debugLine="a2=\"0\" & a2";
_a2 = "0"+_a2;
 }
};
 //BA.debugLineNum = 618;BA.debugLine="For i=7 To 2 Step -1";
{
final double step483 = -1;
final double limit483 = (int)(2);
for (_i = (int)(7); (step483 > 0 && _i <= limit483) || (step483 < 0 && _i >= limit483); _i += step483) {
 //BA.debugLineNum = 619;BA.debugLine="If a1.CharAt(i) =\"1\" Then";
if (_a1.charAt(_i)==BA.ObjectToChar("1")) { 
 //BA.debugLineNum = 620;BA.debugLine="checkbox_switch(row,7-i).Checked= True";
mostCurrent._checkbox_switch[_row][(int)(7-_i)].setChecked(anywheresoftware.b4a.keywords.Common.True);
 }else {
 //BA.debugLineNum = 622;BA.debugLine="checkbox_switch(row,7-i).Checked= False";
mostCurrent._checkbox_switch[_row][(int)(7-_i)].setChecked(anywheresoftware.b4a.keywords.Common.False);
 };
 }
};
 //BA.debugLineNum = 625;BA.debugLine="For i=7 To 2 Step -1";
{
final double step490 = -1;
final double limit490 = (int)(2);
for (_i = (int)(7); (step490 > 0 && _i <= limit490) || (step490 < 0 && _i >= limit490); _i += step490) {
 //BA.debugLineNum = 626;BA.debugLine="If a2.CharAt(i) =\"1\" Then";
if (_a2.charAt(_i)==BA.ObjectToChar("1")) { 
 //BA.debugLineNum = 627;BA.debugLine="checkbox_switch(row,13-i).Checked= True";
mostCurrent._checkbox_switch[_row][(int)(13-_i)].setChecked(anywheresoftware.b4a.keywords.Common.True);
 }else {
 //BA.debugLineNum = 629;BA.debugLine="checkbox_switch(row,13-i).Checked= False";
mostCurrent._checkbox_switch[_row][(int)(13-_i)].setChecked(anywheresoftware.b4a.keywords.Common.False);
 };
 }
};
 }
};
 //BA.debugLineNum = 634;BA.debugLine="TR.Close";
_tr.Close();
 };
 };
 //BA.debugLineNum = 640;BA.debugLine="End Sub";
return "";
}
public static String  _realtime_click() throws Exception{
 //BA.debugLineNum = 657;BA.debugLine="Sub realtime_click()";
 //BA.debugLineNum = 658;BA.debugLine="If connected Then";
if (_connected) { 
 //BA.debugLineNum = 659;BA.debugLine="StartActivity(oscilo)";
anywheresoftware.b4a.keywords.Common.StartActivity(mostCurrent.activityBA,(Object)(mostCurrent._oscilo.getObject()));
 };
 //BA.debugLineNum = 661;BA.debugLine="End Sub";
return "";
}
public static String  _rollpitchrate_click() throws Exception{
 //BA.debugLineNum = 663;BA.debugLine="Sub RollPitchRate_Click";
 //BA.debugLineNum = 664;BA.debugLine="what_col=11";
_what_col = (int)(11);
 //BA.debugLineNum = 665;BA.debugLine="popup(RollPitchRate.Text*100,0)";
_popup((int)((double)(Double.parseDouble(mostCurrent._rollpitchrate.getText()))*100),(int)(0));
 //BA.debugLineNum = 667;BA.debugLine="End Sub";
return "";
}
public static String  _savedata_click() throws Exception{
String _fi = "";
anywheresoftware.b4a.agraham.dialogs.InputDialog.FileDialog _fd = null;
int _ret = 0;
String _temp = "";
anywheresoftware.b4a.objects.streams.File.TextWriterWrapper _tw = null;
anywheresoftware.b4a.objects.collections.List _listdata = null;
int _i = 0;
int _row = 0;
int _a1 = 0;
int _a2 = 0;
 //BA.debugLineNum = 453;BA.debugLine="Sub savedata_Click";
 //BA.debugLineNum = 454;BA.debugLine="Dim fi As String";
_fi = "";
 //BA.debugLineNum = 455;BA.debugLine="Dim fd As FileDialog";
_fd = new anywheresoftware.b4a.agraham.dialogs.InputDialog.FileDialog();
 //BA.debugLineNum = 456;BA.debugLine="Dim ret As Int";
_ret = 0;
 //BA.debugLineNum = 458;BA.debugLine="File.MakeDir(\"/mnt/sdcard\",\"nazecontrol\")";
anywheresoftware.b4a.keywords.Common.File.MakeDir("/mnt/sdcard","nazecontrol");
 //BA.debugLineNum = 459;BA.debugLine="fd.FilePath=\"/mnt/sdcard/nazecontrol\"";
_fd.setFilePath("/mnt/sdcard/nazecontrol");
 //BA.debugLineNum = 460;BA.debugLine="fd.FileFilter=\"naz\"";
_fd.setFileFilter("naz");
 //BA.debugLineNum = 461;BA.debugLine="If File.Exists(fd.FilePath, fi) = True Then";
if (anywheresoftware.b4a.keywords.Common.File.Exists(_fd.getFilePath(),_fi)==anywheresoftware.b4a.keywords.Common.True) { 
 //BA.debugLineNum = 463;BA.debugLine="ret = fd.Show(\"Save\" & fi, \"Save\",\"\",\"Don't save\", Null)";
_ret = _fd.Show("Save"+_fi,"Save","","Don't save",mostCurrent.activityBA,(android.graphics.Bitmap)(anywheresoftware.b4a.keywords.Common.Null));
 //BA.debugLineNum = 464;BA.debugLine="If ret = -2 Then";
if (_ret==-2) { 
 //BA.debugLineNum = 465;BA.debugLine="Return ' \"Don't save\" was pressed.";
if (true) return "";
 }else {
 //BA.debugLineNum = 467;BA.debugLine="Dim temp As String";
_temp = "";
 //BA.debugLineNum = 468;BA.debugLine="temp=DateTime.time(DateTime.Now) & \"_\" & DateTime.Date(DateTime.Now)";
_temp = anywheresoftware.b4a.keywords.Common.DateTime.Time(anywheresoftware.b4a.keywords.Common.DateTime.getNow())+"_"+anywheresoftware.b4a.keywords.Common.DateTime.Date(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
 //BA.debugLineNum = 469;BA.debugLine="temp=temp.Replace(\"/\", \"-\")";
_temp = _temp.replace("/","-");
 //BA.debugLineNum = 470;BA.debugLine="temp=temp.Replace(\":\",\"\")";
_temp = _temp.replace(":","");
 //BA.debugLineNum = 471;BA.debugLine="fi = fd.ChosenName & \" \" & temp";
_fi = _fd.getChosenName()+" "+_temp;
 //BA.debugLineNum = 472;BA.debugLine="If fi.EndsWith(\"naz\") Then";
if (_fi.endsWith("naz")) { 
 }else {
 //BA.debugLineNum = 474;BA.debugLine="fi=fi & \".naz\"";
_fi = _fi+".naz";
 };
 //BA.debugLineNum = 476;BA.debugLine="Dim TW As TextWriter";
_tw = new anywheresoftware.b4a.objects.streams.File.TextWriterWrapper();
 //BA.debugLineNum = 477;BA.debugLine="TW.Initialize(File.OpenOutput(fd.FilePath, fi, False))";
_tw.Initialize((java.io.OutputStream)(anywheresoftware.b4a.keywords.Common.File.OpenOutput(_fd.getFilePath(),_fi,anywheresoftware.b4a.keywords.Common.False).getObject()));
 //BA.debugLineNum = 478;BA.debugLine="Dim listdata As List";
_listdata = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 480;BA.debugLine="listdata.Initialize";
_listdata.Initialize();
 //BA.debugLineNum = 481;BA.debugLine="For i=0 To 5";
{
final double step394 = 1;
final double limit394 = (int)(5);
for (_i = (int)(0); (step394 > 0 && _i <= limit394) || (step394 < 0 && _i >= limit394); _i += step394) {
 //BA.debugLineNum = 482;BA.debugLine="listdata.Add(GetView(i,1).text * 10)";
_listdata.Add((Object)((double)(Double.parseDouble(_getview(_i,(int)(1)).getText()))*10));
 //BA.debugLineNum = 483;BA.debugLine="listdata.Add(GetView(i,2).text * 1000)";
_listdata.Add((Object)((double)(Double.parseDouble(_getview(_i,(int)(2)).getText()))*1000));
 //BA.debugLineNum = 484;BA.debugLine="listdata.Add(GetView(i,3).text)";
_listdata.Add((Object)(_getview(_i,(int)(3)).getText()));
 }
};
 //BA.debugLineNum = 486;BA.debugLine="listdata.Add(GetView(6,1).text*10 )";
_listdata.Add((Object)((double)(Double.parseDouble(_getview((int)(6),(int)(1)).getText()))*10));
 //BA.debugLineNum = 487;BA.debugLine="listdata.Add((rcrate.text * 100))";
_listdata.Add((Object)(((double)(Double.parseDouble(mostCurrent._rcrate.getText()))*100)));
 //BA.debugLineNum = 488;BA.debugLine="listdata.Add( rcexpo.text * 100)";
_listdata.Add((Object)((double)(Double.parseDouble(mostCurrent._rcexpo.getText()))*100));
 //BA.debugLineNum = 489;BA.debugLine="listdata.Add( (RollPitchRate.text * 100))";
_listdata.Add((Object)(((double)(Double.parseDouble(mostCurrent._rollpitchrate.getText()))*100)));
 //BA.debugLineNum = 490;BA.debugLine="listdata.Add((YawRate.text * 100) )";
_listdata.Add((Object)(((double)(Double.parseDouble(mostCurrent._yawrate.getText()))*100)));
 //BA.debugLineNum = 491;BA.debugLine="listdata.Add( (ThrottlePidAtt.text * 100))";
_listdata.Add((Object)(((double)(Double.parseDouble(mostCurrent._throttlepidatt.getText()))*100)));
 //BA.debugLineNum = 492;BA.debugLine="For row=0 To 10";
{
final double step405 = 1;
final double limit405 = (int)(10);
for (_row = (int)(0); (step405 > 0 && _row <= limit405) || (step405 < 0 && _row >= limit405); _row += step405) {
 //BA.debugLineNum = 493;BA.debugLine="Dim a1 As Int";
_a1 = 0;
 //BA.debugLineNum = 494;BA.debugLine="a1=0";
_a1 = (int)(0);
 //BA.debugLineNum = 495;BA.debugLine="For i=2 To 7";
{
final double step408 = 1;
final double limit408 = (int)(7);
for (_i = (int)(2); (step408 > 0 && _i <= limit408) || (step408 < 0 && _i >= limit408); _i += step408) {
 //BA.debugLineNum = 496;BA.debugLine="If checkbox_switch(row,i-2).Checked= True Then";
if (mostCurrent._checkbox_switch[_row][(int)(_i-2)].getChecked()==anywheresoftware.b4a.keywords.Common.True) { 
 //BA.debugLineNum = 497;BA.debugLine="a1 = a1 + Bit.ShiftLeft(1,i-2)";
_a1 = (int)(_a1+anywheresoftware.b4a.keywords.Common.Bit.ShiftLeft((int)(1),(int)(_i-2)));
 };
 }
};
 //BA.debugLineNum = 501;BA.debugLine="Dim a2 As Int";
_a2 = 0;
 //BA.debugLineNum = 502;BA.debugLine="a2=0";
_a2 = (int)(0);
 //BA.debugLineNum = 503;BA.debugLine="For i=2 To 7";
{
final double step415 = 1;
final double limit415 = (int)(7);
for (_i = (int)(2); (step415 > 0 && _i <= limit415) || (step415 < 0 && _i >= limit415); _i += step415) {
 //BA.debugLineNum = 504;BA.debugLine="If checkbox_switch(row,i+4).Checked= True Then";
if (mostCurrent._checkbox_switch[_row][(int)(_i+4)].getChecked()==anywheresoftware.b4a.keywords.Common.True) { 
 //BA.debugLineNum = 505;BA.debugLine="a2 = a2 + Bit.ShiftLeft(1,i-2)";
_a2 = (int)(_a2+anywheresoftware.b4a.keywords.Common.Bit.ShiftLeft((int)(1),(int)(_i-2)));
 };
 }
};
 //BA.debugLineNum = 508;BA.debugLine="listdata.Add(a1)";
_listdata.Add((Object)(_a1));
 //BA.debugLineNum = 509;BA.debugLine="listdata.Add(a2)";
_listdata.Add((Object)(_a2));
 }
};
 //BA.debugLineNum = 511;BA.debugLine="listdata.Add(0)";
_listdata.Add((Object)(0));
 //BA.debugLineNum = 512;BA.debugLine="listdata.Add(0)";
_listdata.Add((Object)(0));
 //BA.debugLineNum = 513;BA.debugLine="For i = 0 To listdata.Size-1";
{
final double step425 = 1;
final double limit425 = (int)(_listdata.getSize()-1);
for (_i = (int)(0); (step425 > 0 && _i <= limit425) || (step425 < 0 && _i >= limit425); _i += step425) {
 //BA.debugLineNum = 514;BA.debugLine="TW.WriteLine(listdata.Get(i))";
_tw.WriteLine(String.valueOf(_listdata.Get(_i)));
 }
};
 //BA.debugLineNum = 517;BA.debugLine="TW.Close";
_tw.Close();
 };
 };
 //BA.debugLineNum = 523;BA.debugLine="End Sub";
return "";
}
public static String  _serial1_connected(boolean _success) throws Exception{
long _ti = 0L;
 //BA.debugLineNum = 1605;BA.debugLine="Sub Serial1_Connected (Success As Boolean)";
 //BA.debugLineNum = 1607;BA.debugLine="If Success Then";
if (_success) { 
 //BA.debugLineNum = 1608;BA.debugLine="ToastMessageShow(\"Connected successfully\", False)";
anywheresoftware.b4a.keywords.Common.ToastMessageShow("Connected successfully",anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 1609;BA.debugLine="TextReader1.Initialize2(serial1.InputStream,\"ISO-8859-1\")";
_textreader1.Initialize2(_serial1.getInputStream(),"ISO-8859-1");
 //BA.debugLineNum = 1610;BA.debugLine="TextWriter1.Initialize2(serial1.OutputStream,\"ISO-8859-1\")";
_textwriter1.Initialize2(_serial1.getOutputStream(),"ISO-8859-1");
 //BA.debugLineNum = 1611;BA.debugLine="Timer1.Enabled = True";
_timer1.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 1612;BA.debugLine="connected = True";
_connected = anywheresoftware.b4a.keywords.Common.True;
 //BA.debugLineNum = 1613;BA.debugLine="connected_label.Text=\"Connected to \" & connected_device";
mostCurrent._connected_label.setText((Object)("Connected to "+_connected_device));
 //BA.debugLineNum = 1614;BA.debugLine="connected_label.Gravity= Gravity.CENTER_HORIZONTAL";
mostCurrent._connected_label.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER_HORIZONTAL);
 //BA.debugLineNum = 1615;BA.debugLine="connected_label.Color=Colors.Green";
mostCurrent._connected_label.setColor(anywheresoftware.b4a.keywords.Common.Colors.Green);
 //BA.debugLineNum = 1616;BA.debugLine="connected_label.TextColor=Colors.Black";
mostCurrent._connected_label.setTextColor(anywheresoftware.b4a.keywords.Common.Colors.Black);
 //BA.debugLineNum = 1617;BA.debugLine="Read.Enabled=True";
mostCurrent._read.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 1618;BA.debugLine="Write.Enabled=True";
mostCurrent._write.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 1619;BA.debugLine="TextWriter1.Write(\"exit\" & CRLF)";
_textwriter1.Write("exit"+anywheresoftware.b4a.keywords.Common.CRLF);
 //BA.debugLineNum = 1620;BA.debugLine="Dim Ti As Long";
_ti = 0L;
 //BA.debugLineNum = 1621;BA.debugLine="Ti = DateTime.Now + (1500)";
_ti = (long)(anywheresoftware.b4a.keywords.Common.DateTime.getNow()+(1500));
 //BA.debugLineNum = 1622;BA.debugLine="Do While DateTime.Now < Ti";
while (anywheresoftware.b4a.keywords.Common.DateTime.getNow()<_ti) {
 //BA.debugLineNum = 1623;BA.debugLine="DoEvents";
anywheresoftware.b4a.keywords.Common.DoEvents();
 }
;
 //BA.debugLineNum = 1625;BA.debugLine="read_Click";
_read_click();
 }else {
 //BA.debugLineNum = 1627;BA.debugLine="connected = False";
_connected = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1628;BA.debugLine="Timer1.Enabled = False";
_timer1.setEnabled(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 1629;BA.debugLine="Msgbox(LastException.Message, \"Error connecting.\")";
anywheresoftware.b4a.keywords.Common.Msgbox(anywheresoftware.b4a.keywords.Common.LastException(mostCurrent.activityBA).getMessage(),"Error connecting.",mostCurrent.activityBA);
 //BA.debugLineNum = 1630;BA.debugLine="connected_label.Text=\"Not Connected\"";
mostCurrent._connected_label.setText((Object)("Not Connected"));
 //BA.debugLineNum = 1631;BA.debugLine="connected_label.Gravity= Gravity.CENTER_HORIZONTAL";
mostCurrent._connected_label.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER_HORIZONTAL);
 //BA.debugLineNum = 1632;BA.debugLine="connected_label.Color=Colors.Red";
mostCurrent._connected_label.setColor(anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 //BA.debugLineNum = 1635;BA.debugLine="End Sub";
return "";
}
public static String  _setcell(int _row,int _col,String _value) throws Exception{
 //BA.debugLineNum = 965;BA.debugLine="Sub SetCell(Row As Int, Col As Int, Value As String)";
 //BA.debugLineNum = 966;BA.debugLine="GetView(Row, Col).Text = Value";
_getview(_row,_col).setText((Object)(_value));
 //BA.debugLineNum = 967;BA.debugLine="End Sub";
return "";
}
public static String  _setheader(String[] _values) throws Exception{
int _i = 0;
anywheresoftware.b4a.objects.LabelWrapper _l = null;
 //BA.debugLineNum = 940;BA.debugLine="Sub SetHeader(Values() As String)";
 //BA.debugLineNum = 941;BA.debugLine="If Header.IsInitialized Then Return 'should only be called once";
if (mostCurrent._header.IsInitialized()) { 
if (true) return "";};
 //BA.debugLineNum = 942;BA.debugLine="Header.Initialize(\"\")";
mostCurrent._header.Initialize(mostCurrent.activityBA,"");
 //BA.debugLineNum = 943;BA.debugLine="For i = 0 To NumberOfColumns - 1";
{
final double step765 = 1;
final double limit765 = (int)(_numberofcolumns-1);
for (_i = (int)(0); (step765 > 0 && _i <= limit765) || (step765 < 0 && _i >= limit765); _i += step765) {
 //BA.debugLineNum = 944;BA.debugLine="Dim l As Label";
_l = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 945;BA.debugLine="l.Initialize(\"header\")";
_l.Initialize(mostCurrent.activityBA,"header");
 //BA.debugLineNum = 946;BA.debugLine="l.Text = Values(i)";
_l.setText((Object)(_values[_i]));
 //BA.debugLineNum = 947;BA.debugLine="l.Gravity = Gravity.CENTER";
_l.setGravity(anywheresoftware.b4a.keywords.Common.Gravity.CENTER);
 //BA.debugLineNum = 948;BA.debugLine="l.TextSize = FontSize";
_l.setTextSize(_fontsize);
 //BA.debugLineNum = 949;BA.debugLine="l.Color = HeaderColor";
_l.setColor(_headercolor);
 //BA.debugLineNum = 950;BA.debugLine="l.TextColor = HeaderFontColor";
_l.setTextColor(_headerfontcolor);
 //BA.debugLineNum = 951;BA.debugLine="l.Tag = i";
_l.setTag((Object)(_i));
 //BA.debugLineNum = 952;BA.debugLine="Header.AddView(l, ColumnWidth * i, 0, ColumnWidth_1, RowHeight_1)";
mostCurrent._header.AddView((android.view.View)(_l.getObject()),(int)(_columnwidth*_i),(int)(0),_columnwidth_1,_rowheight_1);
 //BA.debugLineNum = 953;BA.debugLine="If i=0 Then";
if (_i==0) { 
 //BA.debugLineNum = 954;BA.debugLine="l.Color=Colors.ARGB(255,0,0,0)";
_l.setColor(anywheresoftware.b4a.keywords.Common.Colors.ARGB((int)(255),(int)(0),(int)(0),(int)(0)));
 };
 }
};
 //BA.debugLineNum = 959;BA.debugLine="main_TabHost1_Panel.AddView(Header, SV.Left, SV.Top - RowHeight, SV.Width, RowHeight)";
mostCurrent._main_tabhost1_panel.AddView((android.view.View)(mostCurrent._header.getObject()),mostCurrent._sv.getLeft(),(int)(mostCurrent._sv.getTop()-_rowheight),mostCurrent._sv.getWidth(),_rowheight);
 //BA.debugLineNum = 960;BA.debugLine="End Sub";
return "";
}
public static String  _sk1_valuechanged(int _value,boolean _userchanged) throws Exception{
 //BA.debugLineNum = 699;BA.debugLine="Sub sk1_ValueChanged (Value As Int, UserChanged As Boolean)";
 //BA.debugLineNum = 700;BA.debugLine="If what_col=1 Then";
if (_what_col==1) { 
 //BA.debugLineNum = 701;BA.debugLine="sk1.Max=200";
mostCurrent._sk1.setMax((int)(200));
 //BA.debugLineNum = 702;BA.debugLine="lbl2.Text=sk1.Value/10";
mostCurrent._lbl2.setText((Object)(mostCurrent._sk1.getValue()/(double)10));
 };
 //BA.debugLineNum = 705;BA.debugLine="If what_col=2 Then";
if (_what_col==2) { 
 //BA.debugLineNum = 706;BA.debugLine="sk1.Max=250";
mostCurrent._sk1.setMax((int)(250));
 //BA.debugLineNum = 707;BA.debugLine="lbl2.Text=sk1.Value/1000";
mostCurrent._lbl2.setText((Object)(mostCurrent._sk1.getValue()/(double)1000));
 };
 //BA.debugLineNum = 710;BA.debugLine="If what_col=3 Then";
if (_what_col==3) { 
 //BA.debugLineNum = 711;BA.debugLine="sk1.Max=100";
mostCurrent._sk1.setMax((int)(100));
 //BA.debugLineNum = 712;BA.debugLine="lbl2.Text=sk1.Value";
mostCurrent._lbl2.setText((Object)(mostCurrent._sk1.getValue()));
 };
 //BA.debugLineNum = 715;BA.debugLine="If what_col=10 Then";
if (_what_col==10) { 
 //BA.debugLineNum = 716;BA.debugLine="sk1.Max=250";
mostCurrent._sk1.setMax((int)(250));
 //BA.debugLineNum = 717;BA.debugLine="lbl2.Text=sk1.Value/100";
mostCurrent._lbl2.setText((Object)(mostCurrent._sk1.getValue()/(double)100));
 };
 //BA.debugLineNum = 720;BA.debugLine="If what_col=11 Then";
if (_what_col==11) { 
 //BA.debugLineNum = 721;BA.debugLine="sk1.Max=100";
mostCurrent._sk1.setMax((int)(100));
 //BA.debugLineNum = 722;BA.debugLine="lbl2.Text=sk1.Value/100";
mostCurrent._lbl2.setText((Object)(mostCurrent._sk1.getValue()/(double)100));
 };
 //BA.debugLineNum = 725;BA.debugLine="valor=sk1.Value";
_valor = mostCurrent._sk1.getValue();
 //BA.debugLineNum = 726;BA.debugLine="End Sub";
return "";
}
public static String  _startmotors_click() throws Exception{
 //BA.debugLineNum = 992;BA.debugLine="Sub startmotors_Click()";
 //BA.debugLineNum = 993;BA.debugLine="If motors_reading=False Then";
if (_motors_reading==anywheresoftware.b4a.keywords.Common.False) { 
 //BA.debugLineNum = 994;BA.debugLine="rc_reading=False";
_rc_reading = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 995;BA.debugLine="motors_reading=True";
_motors_reading = anywheresoftware.b4a.keywords.Common.True;
 //BA.debugLineNum = 996;BA.debugLine="Timer1.Interval=35";
_timer1.setInterval((long)(35));
 //BA.debugLineNum = 997;BA.debugLine="start_motors.Text=\"Stop\"";
mostCurrent._start_motors.setText((Object)("Stop"));
 }else {
 //BA.debugLineNum = 999;BA.debugLine="motors_reading=False";
_motors_reading = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1000;BA.debugLine="Timer1.Interval=200";
_timer1.setInterval((long)(200));
 //BA.debugLineNum = 1001;BA.debugLine="start_motors.Text=\"Start\"";
mostCurrent._start_motors.setText((Object)("Start"));
 };
 //BA.debugLineNum = 1003;BA.debugLine="End Sub";
return "";
}
public static String  _startrc_click() throws Exception{
 //BA.debugLineNum = 978;BA.debugLine="Sub startrc_Click()";
 //BA.debugLineNum = 979;BA.debugLine="If rc_reading=False Then";
if (_rc_reading==anywheresoftware.b4a.keywords.Common.False) { 
 //BA.debugLineNum = 980;BA.debugLine="motors_reading=False";
_motors_reading = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 981;BA.debugLine="rc_reading=True";
_rc_reading = anywheresoftware.b4a.keywords.Common.True;
 //BA.debugLineNum = 982;BA.debugLine="Timer1.Interval=35";
_timer1.setInterval((long)(35));
 //BA.debugLineNum = 983;BA.debugLine="start_rc.Text=\"Stop\"";
mostCurrent._start_rc.setText((Object)("Stop"));
 }else {
 //BA.debugLineNum = 985;BA.debugLine="rc_reading=False";
_rc_reading = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 986;BA.debugLine="Timer1.Interval=200";
_timer1.setInterval((long)(200));
 //BA.debugLineNum = 987;BA.debugLine="start_rc.Text=\"Start\"";
mostCurrent._start_rc.setText((Object)("Start"));
 };
 //BA.debugLineNum = 990;BA.debugLine="End Sub";
return "";
}
public static String  _tableaaa() throws Exception{
String[] _rowheader = null;
int _i = 0;
 //BA.debugLineNum = 788;BA.debugLine="Sub tableaaa";
 //BA.debugLineNum = 789;BA.debugLine="SV.Initialize(0)";
mostCurrent._sv.Initialize(mostCurrent.activityBA,(int)(0));
 //BA.debugLineNum = 790;BA.debugLine="Table = SV.panel";
mostCurrent._table = mostCurrent._sv.getPanel();
 //BA.debugLineNum = 791;BA.debugLine="SV.Panel.Color=Colors.Black";
mostCurrent._sv.getPanel().setColor(anywheresoftware.b4a.keywords.Common.Colors.Black);
 //BA.debugLineNum = 792;BA.debugLine="Table = SV.Panel";
mostCurrent._table = mostCurrent._sv.getPanel();
 //BA.debugLineNum = 793;BA.debugLine="Table.Color = LineColor";
mostCurrent._table.setColor(_linecolor);
 //BA.debugLineNum = 794;BA.debugLine="main_TabHost1_Panel.AddView(SV, 2%x, 10%y, 90%x,100%y)";
mostCurrent._main_tabhost1_panel.AddView((android.view.View)(mostCurrent._sv.getObject()),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(2),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(10),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerXToCurrent((float)(90),mostCurrent.activityBA),anywheresoftware.b4a.keywords.Common.PerYToCurrent((float)(100),mostCurrent.activityBA));
 //BA.debugLineNum = 795;BA.debugLine="ColumnWidth = SV.Width / NumberOfColumns";
_columnwidth = (int)(mostCurrent._sv.getWidth()/(double)_numberofcolumns);
 //BA.debugLineNum = 796;BA.debugLine="ColumnWidth_1 = ColumnWidth-ColLineWidth";
_columnwidth_1 = (int)(_columnwidth-_collinewidth);
 //BA.debugLineNum = 797;BA.debugLine="SelectedRow = -1";
_selectedrow = (int)(-1);
 //BA.debugLineNum = 803;BA.debugLine="Dim rowheader(7) As String";
_rowheader = new String[(int)(7)];
java.util.Arrays.fill(_rowheader,"");
 //BA.debugLineNum = 804;BA.debugLine="rowheader= Array As String(\"Pitch/Roll\", \"Yaw\", \"Alt\", \"Alt/vel\", \"GPS\", \"Level\", \"Mag\")";
_rowheader = new String[]{"Pitch/Roll","Yaw","Alt","Alt/vel","GPS","Level","Mag"};
 //BA.debugLineNum = 806;BA.debugLine="SetHeader(Array As String(\" \", \"P\", \"I\", \"D\"))";
_setheader(new String[]{" ","P","I","D"});
 //BA.debugLineNum = 807;BA.debugLine="For i = 0 To 5";
{
final double step643 = 1;
final double limit643 = (int)(5);
for (_i = (int)(0); (step643 > 0 && _i <= limit643) || (step643 < 0 && _i >= limit643); _i += step643) {
 //BA.debugLineNum = 808;BA.debugLine="AddRow(Array As String(rowheader(i), 0.0, 0.0, 0.0))";
_addrow(new String[]{_rowheader[_i],BA.NumberToString(0.0),BA.NumberToString(0.0),BA.NumberToString(0.0)});
 }
};
 //BA.debugLineNum = 810;BA.debugLine="AddRow(Array As String(rowheader(6),0.0,\"\",\"\"))";
_addrow(new String[]{_rowheader[(int)(6)],BA.NumberToString(0.0),"",""});
 //BA.debugLineNum = 812;BA.debugLine="GetView(6,2).Enabled=False";
_getview((int)(6),(int)(2)).setEnabled(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 813;BA.debugLine="GetView(6,3).Enabled = False";
_getview((int)(6),(int)(3)).setEnabled(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 815;BA.debugLine="GetView(6,2).Color=Colors.ARGB(255,0,0,0)";
_getview((int)(6),(int)(2)).setColor(anywheresoftware.b4a.keywords.Common.Colors.ARGB((int)(255),(int)(0),(int)(0),(int)(0)));
 //BA.debugLineNum = 816;BA.debugLine="GetView(6,3).Color=Colors.ARGB(255,0,0,0)";
_getview((int)(6),(int)(3)).setColor(anywheresoftware.b4a.keywords.Common.Colors.ARGB((int)(255),(int)(0),(int)(0),(int)(0)));
 //BA.debugLineNum = 817;BA.debugLine="For i= 0 To NumberOfRows-1";
{
final double step651 = 1;
final double limit651 = (int)(_numberofrows()-1);
for (_i = (int)(0); (step651 > 0 && _i <= limit651) || (step651 < 0 && _i >= limit651); _i += step651) {
 //BA.debugLineNum = 818;BA.debugLine="GetView(i,0).Enabled=False";
_getview(_i,(int)(0)).setEnabled(anywheresoftware.b4a.keywords.Common.False);
 }
};
 //BA.debugLineNum = 822;BA.debugLine="End Sub";
return "";
}
public static String  _throttleexpo_click() throws Exception{
 //BA.debugLineNum = 693;BA.debugLine="Sub throttleexpo_Click";
 //BA.debugLineNum = 694;BA.debugLine="what_col=11";
_what_col = (int)(11);
 //BA.debugLineNum = 695;BA.debugLine="popup(throttleExpo.Text*100,6)";
_popup((int)((double)(Double.parseDouble(mostCurrent._throttleexpo.getText()))*100),(int)(6));
 //BA.debugLineNum = 697;BA.debugLine="End Sub";
return "";
}
public static String  _throttlemid_click() throws Exception{
 //BA.debugLineNum = 688;BA.debugLine="Sub throttlemid_Click";
 //BA.debugLineNum = 689;BA.debugLine="what_col=11";
_what_col = (int)(11);
 //BA.debugLineNum = 690;BA.debugLine="popup(throttleMid.Text*100,5)";
_popup((int)((double)(Double.parseDouble(mostCurrent._throttlemid.getText()))*100),(int)(5));
 //BA.debugLineNum = 692;BA.debugLine="End Sub";
return "";
}
public static String  _throttlepidatt_click() throws Exception{
 //BA.debugLineNum = 673;BA.debugLine="Sub ThrottlePidAtt_Click";
 //BA.debugLineNum = 674;BA.debugLine="what_col=11";
_what_col = (int)(11);
 //BA.debugLineNum = 675;BA.debugLine="popup(ThrottlePidAtt.Text*100,2)";
_popup((int)((double)(Double.parseDouble(mostCurrent._throttlepidatt.getText()))*100),(int)(2));
 //BA.debugLineNum = 677;BA.debugLine="End Sub";
return "";
}
public static String  _timer1_tick() throws Exception{
String _ret = "";
int _h = 0;
int _i = 0;
int[] _ints = null;
int _j = 0;
int[] _act1 = null;
int[] _act2 = null;
int _row = 0;
String _a1 = "";
String _a2 = "";
int[] _activation = null;
char[] _aa = null;
 //BA.debugLineNum = 1004;BA.debugLine="Sub Timer1_Tick";
 //BA.debugLineNum = 1005;BA.debugLine="If connected Then";
if (_connected) { 
 //BA.debugLineNum = 1006;BA.debugLine="If TextReader1.Ready Then 'check if there is any data waiting to be read";
if (_textreader1.Ready()) { 
 //BA.debugLineNum = 1007;BA.debugLine="If return_from_cli=False Then";
if (_return_from_cli==anywheresoftware.b4a.keywords.Common.False) { 
 //BA.debugLineNum = 1008;BA.debugLine="ret=TextReader1.Read(buffer, 0, buffer.Length-1)";
_ret = BA.NumberToString(_textreader1.Read(_buffer,(int)(0),(int)(_buffer.length-1)));
 //BA.debugLineNum = 1009;BA.debugLine="If protocol = 0 Then";
if (_protocol==0) { 
 //BA.debugLineNum = 1010;BA.debugLine="If rc_reading=True Then";
if (_rc_reading==anywheresoftware.b4a.keywords.Common.True) { 
 //BA.debugLineNum = 1011;BA.debugLine="Dim h As Int";
_h = 0;
 //BA.debugLineNum = 1012;BA.debugLine="h=0";
_h = (int)(0);
 //BA.debugLineNum = 1013;BA.debugLine="For i= 56 To 70 Step 2";
{
final double step830 = 2;
final double limit830 = (int)(70);
for (_i = (int)(56); (step830 > 0 && _i <= limit830) || (step830 < 0 && _i >= limit830); _i += step830) {
 //BA.debugLineNum = 1014;BA.debugLine="radios(h).Progress=(read16(Asc(buffer(i)),Asc(buffer(i+1)))-1000)/10";
mostCurrent._radios[_h].setProgress((int)((_read16(anywheresoftware.b4a.keywords.Common.Asc(_buffer[_i]),anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(_i+1)]))-1000)/(double)10));
 //BA.debugLineNum = 1015;BA.debugLine="label_rcdata(h).Text=radios(h).Progress*10+1000";
mostCurrent._label_rcdata[_h].setText((Object)(mostCurrent._radios[_h].getProgress()*10+1000));
 //BA.debugLineNum = 1016;BA.debugLine="h=h+1";
_h = (int)(_h+1);
 }
};
 }else {
 //BA.debugLineNum = 1019;BA.debugLine="If motors_reading=True Then";
if (_motors_reading==anywheresoftware.b4a.keywords.Common.True) { 
 //BA.debugLineNum = 1020;BA.debugLine="Dim h As Int";
_h = 0;
 //BA.debugLineNum = 1021;BA.debugLine="h=0";
_h = (int)(0);
 //BA.debugLineNum = 1022;BA.debugLine="For i= 40 To 54 Step 2";
{
final double step839 = 2;
final double limit839 = (int)(54);
for (_i = (int)(40); (step839 > 0 && _i <= limit839) || (step839 < 0 && _i >= limit839); _i += step839) {
 //BA.debugLineNum = 1023;BA.debugLine="motors(h).Progress=(read16(Asc(buffer(i)),Asc(buffer(i+1)))-1000)/10";
mostCurrent._motors[_h].setProgress((int)((_read16(anywheresoftware.b4a.keywords.Common.Asc(_buffer[_i]),anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(_i+1)]))-1000)/(double)10));
 //BA.debugLineNum = 1024;BA.debugLine="label_motordata(h).Text=motors(h).Progress*10+1000";
mostCurrent._label_motordata[_h].setText((Object)(mostCurrent._motors[_h].getProgress()*10+1000));
 //BA.debugLineNum = 1025;BA.debugLine="h=h+1";
_h = (int)(_h+1);
 }
};
 }else {
 //BA.debugLineNum = 1028;BA.debugLine="If gps_reading=True Then";
if (_gps_reading==anywheresoftware.b4a.keywords.Common.True) { 
 //BA.debugLineNum = 1030;BA.debugLine="gpsfix.Text=\"GPS fix : \" & Asc(buffer(49))";
mostCurrent._gpsfix.setText((Object)("GPS fix : "+BA.NumberToString(anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(49)]))));
 //BA.debugLineNum = 1031;BA.debugLine="gpsnumsat.Text=\"Sats : \" & Asc(buffer(50))";
mostCurrent._gpsnumsat.setText((Object)("Sats : "+BA.NumberToString(anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(50)]))));
 //BA.debugLineNum = 1033;BA.debugLine="gps_lat.Text=\"Lat : \" & read32(read16(Asc(buffer(51)),Asc(buffer(52))),read16(Asc(buffer(53)),Asc(buffer(54))))";
mostCurrent._gps_lat.setText((Object)("Lat : "+BA.NumberToString(_read32(_read16(anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(51)]),anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(52)])),_read16(anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(53)]),anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(54)]))))));
 //BA.debugLineNum = 1034;BA.debugLine="gps_lon.Text=\"Lon : \" & read32(read16(Asc(buffer(55)),Asc(buffer(56))),read16(Asc(buffer(57)),Asc(buffer(58))))";
mostCurrent._gps_lon.setText((Object)("Lon : "+BA.NumberToString(_read32(_read16(anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(55)]),anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(56)])),_read16(anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(57)]),anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(58)]))))));
 //BA.debugLineNum = 1035;BA.debugLine="gps_alt.Text=\"Alt : \" & read16(Asc(buffer(59)),Asc(buffer(60)))";
mostCurrent._gps_alt.setText((Object)("Alt : "+BA.NumberToString(_read16(anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(59)]),anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(60)])))));
 //BA.debugLineNum = 1036;BA.debugLine="gps_speed.Text=\"Speed : \" & read16(Asc(buffer(61)),Asc(buffer(62)))";
mostCurrent._gps_speed.setText((Object)("Speed : "+BA.NumberToString(_read16(anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(61)]),anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(62)])))));
 }else {
 //BA.debugLineNum = 1038;BA.debugLine="Dim ints(155) As Int";
_ints = new int[(int)(155)];
;
 //BA.debugLineNum = 1039;BA.debugLine="For i=0 To 154";
{
final double step854 = 1;
final double limit854 = (int)(154);
for (_i = (int)(0); (step854 > 0 && _i <= limit854) || (step854 < 0 && _i >= limit854); _i += step854) {
 //BA.debugLineNum = 1040;BA.debugLine="ints(i)=Asc(buffer(i))";
_ints[_i] = anywheresoftware.b4a.keywords.Common.Asc(_buffer[_i]);
 }
};
 //BA.debugLineNum = 1043;BA.debugLine="For i= 0 To NumberOfColumns-1";
{
final double step857 = 1;
final double limit857 = (int)(_numberofcolumns-1);
for (_i = (int)(0); (step857 > 0 && _i <= limit857) || (step857 < 0 && _i >= limit857); _i += step857) {
 //BA.debugLineNum = 1044;BA.debugLine="For j=0 To NumberOfRows-1";
{
final double step858 = 1;
final double limit858 = (int)(_numberofrows()-1);
for (_j = (int)(0); (step858 > 0 && _j <= limit858) || (step858 < 0 && _j >= limit858); _j += step858) {
 //BA.debugLineNum = 1045;BA.debugLine="GetView(j, i).Color = CellColor";
_getview(_j,_i).setColor(_cellcolor);
 }
};
 }
};
 //BA.debugLineNum = 1048;BA.debugLine="GetView(6, 2).Color =Colors.Black";
_getview((int)(6),(int)(2)).setColor(anywheresoftware.b4a.keywords.Common.Colors.Black);
 //BA.debugLineNum = 1049;BA.debugLine="GetView(6,3).Color=Colors.Black";
_getview((int)(6),(int)(3)).setColor(anywheresoftware.b4a.keywords.Common.Colors.Black);
 //BA.debugLineNum = 1050;BA.debugLine="For i=0 To 5";
{
final double step864 = 1;
final double limit864 = (int)(5);
for (_i = (int)(0); (step864 > 0 && _i <= limit864) || (step864 < 0 && _i >= limit864); _i += step864) {
 //BA.debugLineNum = 1051;BA.debugLine="SetCell(i,1,ints(86+3*i)/10) 'P";
_setcell(_i,(int)(1),BA.NumberToString(_ints[(int)(86+3*_i)]/(double)10));
 //BA.debugLineNum = 1052;BA.debugLine="SetCell(i,2,ints(86+1+3*i)/1000) 'I";
_setcell(_i,(int)(2),BA.NumberToString(_ints[(int)(86+1+3*_i)]/(double)1000));
 //BA.debugLineNum = 1053;BA.debugLine="SetCell(i,3,ints(86+2+3*i)) 'D";
_setcell(_i,(int)(3),BA.NumberToString(_ints[(int)(86+2+3*_i)]));
 }
};
 //BA.debugLineNum = 1055;BA.debugLine="SetCell(6,1,ints(104)/10) 'mag P";
_setcell((int)(6),(int)(1),BA.NumberToString(_ints[(int)(104)]/(double)10));
 //BA.debugLineNum = 1056;BA.debugLine="rcrate.Text=ints(107)/100";
mostCurrent._rcrate.setText((Object)(_ints[(int)(107)]/(double)100));
 //BA.debugLineNum = 1057;BA.debugLine="rcexpo.Text=ints(108)/100";
mostCurrent._rcexpo.setText((Object)(_ints[(int)(108)]/(double)100));
 //BA.debugLineNum = 1058;BA.debugLine="RollPitchRate.Text=ints(109)/100";
mostCurrent._rollpitchrate.setText((Object)(_ints[(int)(109)]/(double)100));
 //BA.debugLineNum = 1059;BA.debugLine="YawRate.Text=ints(110)/100";
mostCurrent._yawrate.setText((Object)(_ints[(int)(110)]/(double)100));
 //BA.debugLineNum = 1060;BA.debugLine="ThrottlePidAtt.Text=ints(111)/100";
mostCurrent._throttlepidatt.setText((Object)(_ints[(int)(111)]/(double)100));
 //BA.debugLineNum = 1062;BA.debugLine="Dim act1(30) As Int";
_act1 = new int[(int)(30)];
;
 //BA.debugLineNum = 1063;BA.debugLine="Dim act2(30) As Int";
_act2 = new int[(int)(30)];
;
 //BA.debugLineNum = 1064;BA.debugLine="For i=0 To 10";
{
final double step877 = 1;
final double limit877 = (int)(10);
for (_i = (int)(0); (step877 > 0 && _i <= limit877) || (step877 < 0 && _i >= limit877); _i += step877) {
 //BA.debugLineNum = 1065;BA.debugLine="act1(i)=ints(112+2*i)";
_act1[_i] = _ints[(int)(112+2*_i)];
 //BA.debugLineNum = 1066;BA.debugLine="act2(i)=ints(113+2*i)";
_act2[_i] = _ints[(int)(113+2*_i)];
 }
};
 //BA.debugLineNum = 1068;BA.debugLine="For row=0 To 10";
{
final double step881 = 1;
final double limit881 = (int)(10);
for (_row = (int)(0); (step881 > 0 && _row <= limit881) || (step881 < 0 && _row >= limit881); _row += step881) {
 //BA.debugLineNum = 1069;BA.debugLine="Dim a1,a2 As String";
_a1 = "";
_a2 = "";
 //BA.debugLineNum = 1070;BA.debugLine="a1=Bit.ToBinaryString(act1(row))";
_a1 = anywheresoftware.b4a.keywords.Common.Bit.ToBinaryString(_act1[_row]);
 //BA.debugLineNum = 1071;BA.debugLine="a2=Bit.ToBinaryString(act2(row))";
_a2 = anywheresoftware.b4a.keywords.Common.Bit.ToBinaryString(_act2[_row]);
 //BA.debugLineNum = 1073;BA.debugLine="For i=a1.Length To 7";
{
final double step885 = 1;
final double limit885 = (int)(7);
for (_i = _a1.length(); (step885 > 0 && _i <= limit885) || (step885 < 0 && _i >= limit885); _i += step885) {
 //BA.debugLineNum = 1074;BA.debugLine="a1=\"0\" & a1";
_a1 = "0"+_a1;
 }
};
 //BA.debugLineNum = 1076;BA.debugLine="For i=a2.Length To 7";
{
final double step888 = 1;
final double limit888 = (int)(7);
for (_i = _a2.length(); (step888 > 0 && _i <= limit888) || (step888 < 0 && _i >= limit888); _i += step888) {
 //BA.debugLineNum = 1077;BA.debugLine="a2=\"0\" & a2";
_a2 = "0"+_a2;
 }
};
 //BA.debugLineNum = 1080;BA.debugLine="For i=7 To 2 Step -1";
{
final double step891 = -1;
final double limit891 = (int)(2);
for (_i = (int)(7); (step891 > 0 && _i <= limit891) || (step891 < 0 && _i >= limit891); _i += step891) {
 //BA.debugLineNum = 1081;BA.debugLine="If a1.CharAt(i) =\"1\" Then";
if (_a1.charAt(_i)==BA.ObjectToChar("1")) { 
 //BA.debugLineNum = 1082;BA.debugLine="checkbox_switch(row,7-i).Checked= True";
mostCurrent._checkbox_switch[_row][(int)(7-_i)].setChecked(anywheresoftware.b4a.keywords.Common.True);
 }else {
 //BA.debugLineNum = 1084;BA.debugLine="checkbox_switch(row,7-i).Checked= False";
mostCurrent._checkbox_switch[_row][(int)(7-_i)].setChecked(anywheresoftware.b4a.keywords.Common.False);
 };
 }
};
 //BA.debugLineNum = 1087;BA.debugLine="For i=7 To 2 Step -1";
{
final double step898 = -1;
final double limit898 = (int)(2);
for (_i = (int)(7); (step898 > 0 && _i <= limit898) || (step898 < 0 && _i >= limit898); _i += step898) {
 //BA.debugLineNum = 1088;BA.debugLine="If a2.CharAt(i) =\"1\" Then";
if (_a2.charAt(_i)==BA.ObjectToChar("1")) { 
 //BA.debugLineNum = 1089;BA.debugLine="checkbox_switch(row,13-i).Checked= True";
mostCurrent._checkbox_switch[_row][(int)(13-_i)].setChecked(anywheresoftware.b4a.keywords.Common.True);
 }else {
 //BA.debugLineNum = 1091;BA.debugLine="checkbox_switch(row,13-i).Checked= False";
mostCurrent._checkbox_switch[_row][(int)(13-_i)].setChecked(anywheresoftware.b4a.keywords.Common.False);
 };
 }
};
 }
};
 //BA.debugLineNum = 1096;BA.debugLine="GPS_distanceToHome = read16(ints(134),ints(135))";
_gps_distancetohome = _read16(_ints[(int)(134)],_ints[(int)(135)]);
 //BA.debugLineNum = 1097;BA.debugLine="GPS_directionToHome = read16(ints(136),ints(137))";
_gps_directiontohome = _read16(_ints[(int)(136)],_ints[(int)(137)]);
 //BA.debugLineNum = 1098;BA.debugLine="GPS_numSat = read8(ints(138))";
_gps_numsat = _read8(_ints[(int)(138)]);
 //BA.debugLineNum = 1099;BA.debugLine="GPS_fix = read8(ints(139))";
_gps_fix = _read8(_ints[(int)(139)]);
 //BA.debugLineNum = 1100;BA.debugLine="GPS_update = read8(ints(140))";
_gps_update = _read8(_ints[(int)(140)]);
 //BA.debugLineNum = 1106;BA.debugLine="pMeterSum = read16(ints(141),ints(142))";
_pmetersum = _read16(_ints[(int)(141)],_ints[(int)(142)]);
 //BA.debugLineNum = 1107;BA.debugLine="intPowerTrigger = read16(ints(143),ints(144))";
_intpowertrigger = _read16(_ints[(int)(143)],_ints[(int)(144)]);
 //BA.debugLineNum = 1108;BA.debugLine="bytevbat = read8(ints(145))   'old protocol";
_bytevbat = _read8(_ints[(int)(145)]);
 };
 };
 };
 }else {
 //BA.debugLineNum = 1116;BA.debugLine="Dim ints(155) As Int";
_ints = new int[(int)(155)];
;
 //BA.debugLineNum = 1117;BA.debugLine="For i=0 To ret";
{
final double step919 = 1;
final double limit919 = (int)(Double.parseDouble(_ret));
for (_i = (int)(0); (step919 > 0 && _i <= limit919) || (step919 < 0 && _i >= limit919); _i += step919) {
 //BA.debugLineNum = 1118;BA.debugLine="ints(i)=Asc(buffer(i))";
_ints[_i] = anywheresoftware.b4a.keywords.Common.Asc(_buffer[_i]);
 }
};
 //BA.debugLineNum = 1120;BA.debugLine="stateMSP=ints(4)";
_statemsp = _ints[(int)(4)];
 //BA.debugLineNum = 1122;BA.debugLine="If stateMSP>99 Then";
if (_statemsp>99) { 
 //BA.debugLineNum = 1123;BA.debugLine="Select stateMSP";
switch (BA.switchObjectToInt(_statemsp,(int)(Double.parseDouble(_msp_ident)),(int)(Double.parseDouble(_msp_raw_imu)),(int)(Double.parseDouble(_msp_servo)),(int)(Double.parseDouble(_msp_motor)),(int)(Double.parseDouble(_msp_rc)),(int)(Double.parseDouble(_msp_raw_gps)),(int)(Double.parseDouble(_msp_comp_gps)),(int)(Double.parseDouble(_msp_attitude)),(int)(Double.parseDouble(_msp_rc_tuning)),(int)(Double.parseDouble(_msp_acc_calibration)),(int)(Double.parseDouble(_msp_mag_calibration)),(int)(Double.parseDouble(_msp_pid)),(int)(Double.parseDouble(_msp_box)))) {
case 0:
 //BA.debugLineNum = 1125;BA.debugLine="stateMSP = 0";
_statemsp = (int)(0);
 break;
case 1:
 break;
case 2:
 break;
case 3:
 //BA.debugLineNum = 1145;BA.debugLine="stateMSP = 0";
_statemsp = (int)(0);
 //BA.debugLineNum = 1146;BA.debugLine="Dim h As Int";
_h = 0;
 //BA.debugLineNum = 1147;BA.debugLine="h=0";
_h = (int)(0);
 //BA.debugLineNum = 1148;BA.debugLine="For i= 5 To 19 Step 2";
{
final double step933 = 2;
final double limit933 = (int)(19);
for (_i = (int)(5); (step933 > 0 && _i <= limit933) || (step933 < 0 && _i >= limit933); _i += step933) {
 //BA.debugLineNum = 1149;BA.debugLine="motors(h).Progress=(read16(ints(i),ints(i+1))-1000)/10";
mostCurrent._motors[_h].setProgress((int)((_read16(_ints[_i],_ints[(int)(_i+1)])-1000)/(double)10));
 //BA.debugLineNum = 1150;BA.debugLine="label_motordata(h).Text=motors(h).Progress*10+1000";
mostCurrent._label_motordata[_h].setText((Object)(mostCurrent._motors[_h].getProgress()*10+1000));
 //BA.debugLineNum = 1151;BA.debugLine="h=h+1";
_h = (int)(_h+1);
 }
};
 break;
case 4:
 //BA.debugLineNum = 1154;BA.debugLine="stateMSP = 0";
_statemsp = (int)(0);
 //BA.debugLineNum = 1155;BA.debugLine="Dim h As Int";
_h = 0;
 //BA.debugLineNum = 1156;BA.debugLine="h=0";
_h = (int)(0);
 //BA.debugLineNum = 1157;BA.debugLine="For i= 5 To 19 Step 2";
{
final double step942 = 2;
final double limit942 = (int)(19);
for (_i = (int)(5); (step942 > 0 && _i <= limit942) || (step942 < 0 && _i >= limit942); _i += step942) {
 //BA.debugLineNum = 1158;BA.debugLine="radios(h).Progress=(read16(Asc(buffer(i)),Asc(buffer(i+1)))-1000)/10";
mostCurrent._radios[_h].setProgress((int)((_read16(anywheresoftware.b4a.keywords.Common.Asc(_buffer[_i]),anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(_i+1)]))-1000)/(double)10));
 //BA.debugLineNum = 1159;BA.debugLine="label_rcdata(h).Text=radios(h).Progress*10+1000";
mostCurrent._label_rcdata[_h].setText((Object)(mostCurrent._radios[_h].getProgress()*10+1000));
 //BA.debugLineNum = 1160;BA.debugLine="h=h+1";
_h = (int)(_h+1);
 }
};
 break;
case 5:
 //BA.debugLineNum = 1168;BA.debugLine="stateMSP = 0";
_statemsp = (int)(0);
 //BA.debugLineNum = 1169;BA.debugLine="gpsfix.Text=\"GPS fix : \" & Asc(buffer(5))";
mostCurrent._gpsfix.setText((Object)("GPS fix : "+BA.NumberToString(anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(5)]))));
 //BA.debugLineNum = 1170;BA.debugLine="gpsnumsat.Text=\"Sats : \" & Asc(buffer(6))";
mostCurrent._gpsnumsat.setText((Object)("Sats : "+BA.NumberToString(anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(6)]))));
 //BA.debugLineNum = 1171;BA.debugLine="gps_lat.Text=\"Lat : \" & read32(read16(Asc(buffer(7)),Asc(buffer(8))),read16(Asc(buffer(9)),Asc(buffer(10))))";
mostCurrent._gps_lat.setText((Object)("Lat : "+BA.NumberToString(_read32(_read16(anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(7)]),anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(8)])),_read16(anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(9)]),anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(10)]))))));
 //BA.debugLineNum = 1172;BA.debugLine="gps_lon.Text=\"Lon : \" & read32(read16(Asc(buffer(11)),Asc(buffer(12))),read16(Asc(buffer(13)),Asc(buffer(14))))";
mostCurrent._gps_lon.setText((Object)("Lon : "+BA.NumberToString(_read32(_read16(anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(11)]),anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(12)])),_read16(anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(13)]),anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(14)]))))));
 //BA.debugLineNum = 1173;BA.debugLine="gps_alt.Text=\"Alt : \" & read16(Asc(buffer(15)),Asc(buffer(16)))";
mostCurrent._gps_alt.setText((Object)("Alt : "+BA.NumberToString(_read16(anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(15)]),anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(16)])))));
 //BA.debugLineNum = 1174;BA.debugLine="gps_speed.Text=\"Speed : \" & read16(Asc(buffer(17)),Asc(buffer(18)))";
mostCurrent._gps_speed.setText((Object)("Speed : "+BA.NumberToString(_read16(anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(17)]),anywheresoftware.b4a.keywords.Common.Asc(_buffer[(int)(18)])))));
 break;
case 6:
 break;
case 7:
 //BA.debugLineNum = 1182;BA.debugLine="stateMSP = 0";
_statemsp = (int)(0);
 break;
case 8:
 //BA.debugLineNum = 1188;BA.debugLine="stateMSP = 0";
_statemsp = (int)(0);
 //BA.debugLineNum = 1189;BA.debugLine="rcrate.Text=ints(5)/100";
mostCurrent._rcrate.setText((Object)(_ints[(int)(5)]/(double)100));
 //BA.debugLineNum = 1190;BA.debugLine="rcexpo.Text=ints(6)/100";
mostCurrent._rcexpo.setText((Object)(_ints[(int)(6)]/(double)100));
 //BA.debugLineNum = 1191;BA.debugLine="RollPitchRate.Text=ints(7)/100";
mostCurrent._rollpitchrate.setText((Object)(_ints[(int)(7)]/(double)100));
 //BA.debugLineNum = 1192;BA.debugLine="YawRate.Text=ints(8)/100";
mostCurrent._yawrate.setText((Object)(_ints[(int)(8)]/(double)100));
 //BA.debugLineNum = 1193;BA.debugLine="ThrottlePidAtt.Text=ints(9)/100";
mostCurrent._throttlepidatt.setText((Object)(_ints[(int)(9)]/(double)100));
 //BA.debugLineNum = 1194;BA.debugLine="throttleMid.text=ints(10)/100";
mostCurrent._throttlemid.setText((Object)(_ints[(int)(10)]/(double)100));
 //BA.debugLineNum = 1195;BA.debugLine="throttleExpo.text=ints(11)/100";
mostCurrent._throttleexpo.setText((Object)(_ints[(int)(11)]/(double)100));
 break;
case 9:
 //BA.debugLineNum = 1198;BA.debugLine="stateMSP = 0";
_statemsp = (int)(0);
 break;
case 10:
 //BA.debugLineNum = 1200;BA.debugLine="stateMSP = 0";
_statemsp = (int)(0);
 break;
case 11:
 //BA.debugLineNum = 1202;BA.debugLine="stateMSP = 0";
_statemsp = (int)(0);
 //BA.debugLineNum = 1203;BA.debugLine="For i=0 To 5";
{
final double step973 = 1;
final double limit973 = (int)(5);
for (_i = (int)(0); (step973 > 0 && _i <= limit973) || (step973 < 0 && _i >= limit973); _i += step973) {
 //BA.debugLineNum = 1204;BA.debugLine="SetCell(i,1,ints(8+3*i)/10) 'P";
_setcell(_i,(int)(1),BA.NumberToString(_ints[(int)(8+3*_i)]/(double)10));
 //BA.debugLineNum = 1205;BA.debugLine="SetCell(i,2,ints(8+1+3*i)/1000) 'I";
_setcell(_i,(int)(2),BA.NumberToString(_ints[(int)(8+1+3*_i)]/(double)1000));
 //BA.debugLineNum = 1206;BA.debugLine="SetCell(i,3,ints(8+2+3*i)) 'D";
_setcell(_i,(int)(3),BA.NumberToString(_ints[(int)(8+2+3*_i)]));
 }
};
 //BA.debugLineNum = 1208;BA.debugLine="SetCell(6,1,ints(26)/10)";
_setcell((int)(6),(int)(1),BA.NumberToString(_ints[(int)(26)]/(double)10));
 break;
case 12:
 //BA.debugLineNum = 1210;BA.debugLine="stateMSP = 0";
_statemsp = (int)(0);
 //BA.debugLineNum = 1211;BA.debugLine="Dim activation(30) As Int";
_activation = new int[(int)(30)];
;
 //BA.debugLineNum = 1212;BA.debugLine="For i=0 To 10";
{
final double step982 = 1;
final double limit982 = (int)(10);
for (_i = (int)(0); (step982 > 0 && _i <= limit982) || (step982 < 0 && _i >= limit982); _i += step982) {
 //BA.debugLineNum = 1213;BA.debugLine="activation(i) = read16(ints(5+2*i), ints(6+2*i))";
_activation[_i] = _read16(_ints[(int)(5+2*_i)],_ints[(int)(6+2*_i)]);
 }
};
 //BA.debugLineNum = 1215;BA.debugLine="For row=0 To 10";
{
final double step985 = 1;
final double limit985 = (int)(10);
for (_row = (int)(0); (step985 > 0 && _row <= limit985) || (step985 < 0 && _row >= limit985); _row += step985) {
 //BA.debugLineNum = 1216;BA.debugLine="Dim a1 As String";
_a1 = "";
 //BA.debugLineNum = 1217;BA.debugLine="a1=Bit.ToBinaryString(activation(row))";
_a1 = anywheresoftware.b4a.keywords.Common.Bit.ToBinaryString(_activation[_row]);
 //BA.debugLineNum = 1219;BA.debugLine="For i=a1.Length To 15";
{
final double step988 = 1;
final double limit988 = (int)(15);
for (_i = _a1.length(); (step988 > 0 && _i <= limit988) || (step988 < 0 && _i >= limit988); _i += step988) {
 //BA.debugLineNum = 1220;BA.debugLine="a1=\"0\" & a1";
_a1 = "0"+_a1;
 }
};
 //BA.debugLineNum = 1222;BA.debugLine="For i=15 To 4 Step -1";
{
final double step991 = -1;
final double limit991 = (int)(4);
for (_i = (int)(15); (step991 > 0 && _i <= limit991) || (step991 < 0 && _i >= limit991); _i += step991) {
 //BA.debugLineNum = 1223;BA.debugLine="If a1.CharAt(i) =\"1\" Then";
if (_a1.charAt(_i)==BA.ObjectToChar("1")) { 
 //BA.debugLineNum = 1224;BA.debugLine="checkbox_switch(row,15-i).Checked= True";
mostCurrent._checkbox_switch[_row][(int)(15-_i)].setChecked(anywheresoftware.b4a.keywords.Common.True);
 }else {
 //BA.debugLineNum = 1226;BA.debugLine="checkbox_switch(row,15-i).Checked= False";
mostCurrent._checkbox_switch[_row][(int)(15-_i)].setChecked(anywheresoftware.b4a.keywords.Common.False);
 };
 }
};
 }
};
 break;
}
;
 };
 };
 }else {
 //BA.debugLineNum = 1244;BA.debugLine="Dim aa(1000) As Char";
_aa = new char[(int)(1000)];
;
 //BA.debugLineNum = 1245;BA.debugLine="ret=TextReader1.Read(aa, 0, aa.Length-1)";
_ret = BA.NumberToString(_textreader1.Read(_aa,(int)(0),(int)(_aa.length-1)));
 //BA.debugLineNum = 1246;BA.debugLine="return_from_cli=False";
_return_from_cli = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 1247;BA.debugLine="read_Click";
_read_click();
 };
 }else {
 //BA.debugLineNum = 1251;BA.debugLine="If protocol =0 Then";
if (_protocol==0) { 
 //BA.debugLineNum = 1253;BA.debugLine="If rc_reading=True Then   'rc data";
if (_rc_reading==anywheresoftware.b4a.keywords.Common.True) { 
 //BA.debugLineNum = 1254;BA.debugLine="TextWriter1.Write(\"M\")";
_textwriter1.Write("M");
 //BA.debugLineNum = 1255;BA.debugLine="TextWriter1.Flush";
_textwriter1.Flush();
 }else if(_motors_reading==anywheresoftware.b4a.keywords.Common.True) { 
 //BA.debugLineNum = 1258;BA.debugLine="TextWriter1.Write(\"M\")";
_textwriter1.Write("M");
 //BA.debugLineNum = 1259;BA.debugLine="TextWriter1.Flush";
_textwriter1.Flush();
 }else if(_gps_reading==anywheresoftware.b4a.keywords.Common.True) { 
 //BA.debugLineNum = 1262;BA.debugLine="TextWriter1.Write(\"O\")";
_textwriter1.Write("O");
 //BA.debugLineNum = 1263;BA.debugLine="TextWriter1.Flush";
_textwriter1.Flush();
 };
 }else {
 //BA.debugLineNum = 1267;BA.debugLine="Select CurrentTab";
switch (_currenttab) {
case 0:
 //BA.debugLineNum = 1269;BA.debugLine="TextWriter1.Write(\"$M<\" & Chr(MSP_PID))";
_textwriter1.Write("$M<"+String.valueOf(anywheresoftware.b4a.keywords.Common.Chr((int)(Double.parseDouble(_msp_pid)))));
 //BA.debugLineNum = 1270;BA.debugLine="TextWriter1.Flush";
_textwriter1.Flush();
 break;
case 1:
 //BA.debugLineNum = 1272;BA.debugLine="If rc_reading=True Then";
if (_rc_reading==anywheresoftware.b4a.keywords.Common.True) { 
 //BA.debugLineNum = 1273;BA.debugLine="TextWriter1.Write(\"$M<\" & Chr(MSP_RC))";
_textwriter1.Write("$M<"+String.valueOf(anywheresoftware.b4a.keywords.Common.Chr((int)(Double.parseDouble(_msp_rc)))));
 //BA.debugLineNum = 1274;BA.debugLine="TextWriter1.Flush";
_textwriter1.Flush();
 }else if(_motors_reading==anywheresoftware.b4a.keywords.Common.True) { 
 //BA.debugLineNum = 1276;BA.debugLine="TextWriter1.Write(\"$M<\" & Chr(MSP_MOTOR))";
_textwriter1.Write("$M<"+String.valueOf(anywheresoftware.b4a.keywords.Common.Chr((int)(Double.parseDouble(_msp_motor)))));
 //BA.debugLineNum = 1277;BA.debugLine="TextWriter1.Flush";
_textwriter1.Flush();
 }else {
 //BA.debugLineNum = 1279;BA.debugLine="TextWriter1.Write(\"$M<\" & Chr(MSP_RC_TUNING))";
_textwriter1.Write("$M<"+String.valueOf(anywheresoftware.b4a.keywords.Common.Chr((int)(Double.parseDouble(_msp_rc_tuning)))));
 //BA.debugLineNum = 1280;BA.debugLine="TextWriter1.Flush";
_textwriter1.Flush();
 };
 break;
case 2:
 //BA.debugLineNum = 1285;BA.debugLine="TextWriter1.Write(\"$M<\" & Chr(MSP_RC))";
_textwriter1.Write("$M<"+String.valueOf(anywheresoftware.b4a.keywords.Common.Chr((int)(Double.parseDouble(_msp_rc)))));
 //BA.debugLineNum = 1286;BA.debugLine="TextWriter1.Flush";
_textwriter1.Flush();
 break;
}
;
 };
 };
 };
 //BA.debugLineNum = 1293;BA.debugLine="End Sub";
return "";
}
public static String  _tmranimation_tick() throws Exception{
 //BA.debugLineNum = 1677;BA.debugLine="Sub tmrAnimation_Tick";
 //BA.debugLineNum = 1678;BA.debugLine="tmrAnimation.Enabled = False";
_tmranimation.setEnabled(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 1679;BA.debugLine="ContinueJumping";
_continuejumping();
 //BA.debugLineNum = 1680;BA.debugLine="End Sub";
return "";
}
public static String  _write_click() throws Exception{
byte[] _arr = null;
String _texttosend = "";
int _i = 0;
int _row = 0;
int _a1 = 0;
int _a2 = 0;
String _text = "";
 //BA.debugLineNum = 1303;BA.debugLine="Sub Write_Click";
 //BA.debugLineNum = 1304;BA.debugLine="Dim arr(250) As Byte";
_arr = new byte[(int)(250)];
;
 //BA.debugLineNum = 1305;BA.debugLine="Dim textToSend As String";
_texttosend = "";
 //BA.debugLineNum = 1306;BA.debugLine="textToSend=\"\"";
_texttosend = "";
 //BA.debugLineNum = 1307;BA.debugLine="If protocol=0 Then";
if (_protocol==0) { 
 //BA.debugLineNum = 1308;BA.debugLine="arr(0)=87";
_arr[(int)(0)] = (byte)(87);
 //BA.debugLineNum = 1309;BA.debugLine="arr(1)=GetView(0,1).text * 10";
_arr[(int)(1)] = (byte)((double)(Double.parseDouble(_getview((int)(0),(int)(1)).getText()))*10);
 //BA.debugLineNum = 1310;BA.debugLine="arr(2)=GetView(0,2).text * 1000";
_arr[(int)(2)] = (byte)((double)(Double.parseDouble(_getview((int)(0),(int)(2)).getText()))*1000);
 //BA.debugLineNum = 1311;BA.debugLine="arr(3)=GetView(0,3).text";
_arr[(int)(3)] = (byte)(Double.parseDouble(_getview((int)(0),(int)(3)).getText()));
 //BA.debugLineNum = 1312;BA.debugLine="For i=0 To 5";
{
final double step1062 = 1;
final double limit1062 = (int)(5);
for (_i = (int)(0); (step1062 > 0 && _i <= limit1062) || (step1062 < 0 && _i >= limit1062); _i += step1062) {
 //BA.debugLineNum = 1313;BA.debugLine="arr(4+3*i)=GetView(i,1).text * 10";
_arr[(int)(4+3*_i)] = (byte)((double)(Double.parseDouble(_getview(_i,(int)(1)).getText()))*10);
 //BA.debugLineNum = 1314;BA.debugLine="arr(5+3*i)=GetView(i,2).text * 1000";
_arr[(int)(5+3*_i)] = (byte)((double)(Double.parseDouble(_getview(_i,(int)(2)).getText()))*1000);
 //BA.debugLineNum = 1315;BA.debugLine="arr(6+3*i)=GetView(i,3).text";
_arr[(int)(6+3*_i)] = (byte)(Double.parseDouble(_getview(_i,(int)(3)).getText()));
 }
};
 //BA.debugLineNum = 1317;BA.debugLine="arr(22)= GetView(6,1).text*10";
_arr[(int)(22)] = (byte)((double)(Double.parseDouble(_getview((int)(6),(int)(1)).getText()))*10);
 //BA.debugLineNum = 1318;BA.debugLine="arr(23)=0";
_arr[(int)(23)] = (byte)(0);
 //BA.debugLineNum = 1319;BA.debugLine="arr(24)=0";
_arr[(int)(24)] = (byte)(0);
 //BA.debugLineNum = 1320;BA.debugLine="arr(25)= (rcrate.text * 100)";
_arr[(int)(25)] = (byte)(((double)(Double.parseDouble(mostCurrent._rcrate.getText()))*100));
 //BA.debugLineNum = 1321;BA.debugLine="arr(26) = rcexpo.text * 100";
_arr[(int)(26)] = (byte)((double)(Double.parseDouble(mostCurrent._rcexpo.getText()))*100);
 //BA.debugLineNum = 1322;BA.debugLine="arr(27)= (RollPitchRate.text * 100)";
_arr[(int)(27)] = (byte)(((double)(Double.parseDouble(mostCurrent._rollpitchrate.getText()))*100));
 //BA.debugLineNum = 1323;BA.debugLine="arr(28)=(YawRate.text * 100)";
_arr[(int)(28)] = (byte)(((double)(Double.parseDouble(mostCurrent._yawrate.getText()))*100));
 //BA.debugLineNum = 1324;BA.debugLine="arr(29)= (ThrottlePidAtt.text * 100)";
_arr[(int)(29)] = (byte)(((double)(Double.parseDouble(mostCurrent._throttlepidatt.getText()))*100));
 //BA.debugLineNum = 1325;BA.debugLine="For row=0 To 10";
{
final double step1075 = 1;
final double limit1075 = (int)(10);
for (_row = (int)(0); (step1075 > 0 && _row <= limit1075) || (step1075 < 0 && _row >= limit1075); _row += step1075) {
 //BA.debugLineNum = 1326;BA.debugLine="Dim a1 As Int";
_a1 = 0;
 //BA.debugLineNum = 1327;BA.debugLine="a1=0";
_a1 = (int)(0);
 //BA.debugLineNum = 1328;BA.debugLine="For i=2 To 7";
{
final double step1078 = 1;
final double limit1078 = (int)(7);
for (_i = (int)(2); (step1078 > 0 && _i <= limit1078) || (step1078 < 0 && _i >= limit1078); _i += step1078) {
 //BA.debugLineNum = 1329;BA.debugLine="If checkbox_switch(row,i-2).Checked= True Then";
if (mostCurrent._checkbox_switch[_row][(int)(_i-2)].getChecked()==anywheresoftware.b4a.keywords.Common.True) { 
 //BA.debugLineNum = 1330;BA.debugLine="a1 = a1 + Bit.ShiftLeft(1,i-2)";
_a1 = (int)(_a1+anywheresoftware.b4a.keywords.Common.Bit.ShiftLeft((int)(1),(int)(_i-2)));
 };
 }
};
 //BA.debugLineNum = 1334;BA.debugLine="Dim a2 As Int";
_a2 = 0;
 //BA.debugLineNum = 1335;BA.debugLine="a2=0";
_a2 = (int)(0);
 //BA.debugLineNum = 1336;BA.debugLine="For i=2 To 7";
{
final double step1085 = 1;
final double limit1085 = (int)(7);
for (_i = (int)(2); (step1085 > 0 && _i <= limit1085) || (step1085 < 0 && _i >= limit1085); _i += step1085) {
 //BA.debugLineNum = 1337;BA.debugLine="If checkbox_switch(row,i+4).Checked= True Then";
if (mostCurrent._checkbox_switch[_row][(int)(_i+4)].getChecked()==anywheresoftware.b4a.keywords.Common.True) { 
 //BA.debugLineNum = 1338;BA.debugLine="a2 = a2 + Bit.ShiftLeft(1,i-2)";
_a2 = (int)(_a2+anywheresoftware.b4a.keywords.Common.Bit.ShiftLeft((int)(1),(int)(_i-2)));
 };
 }
};
 //BA.debugLineNum = 1341;BA.debugLine="arr(30+2*row)=a1";
_arr[(int)(30+2*_row)] = (byte)(_a1);
 //BA.debugLineNum = 1342;BA.debugLine="arr(31+2*row)=a2";
_arr[(int)(31+2*_row)] = (byte)(_a2);
 }
};
 //BA.debugLineNum = 1344;BA.debugLine="arr(42)=0";
_arr[(int)(42)] = (byte)(0);
 //BA.debugLineNum = 1345;BA.debugLine="arr(43)=0";
_arr[(int)(43)] = (byte)(0);
 //BA.debugLineNum = 1347;BA.debugLine="Dim text As String";
_text = "";
 //BA.debugLineNum = 1348;BA.debugLine="textToSend=converter.StringFromBytes(arr,\"ISO-8859-1\")";
_texttosend = _converter.StringFromBytes(_arr,"ISO-8859-1");
 //BA.debugLineNum = 1350;BA.debugLine="TextWriter1.Write(textToSend)";
_textwriter1.Write(_texttosend);
 //BA.debugLineNum = 1351;BA.debugLine="TextWriter1.flush";
_textwriter1.Flush();
 }else {
 //BA.debugLineNum = 1354;BA.debugLine="checksum=0";
_checksum = (byte)(0);
 //BA.debugLineNum = 1355;BA.debugLine="arr(0)= Asc(\"$\")";
_arr[(int)(0)] = (byte)(anywheresoftware.b4a.keywords.Common.Asc(BA.ObjectToChar("$")));
 //BA.debugLineNum = 1356;BA.debugLine="arr(1)=Asc(\"M\")";
_arr[(int)(1)] = (byte)(anywheresoftware.b4a.keywords.Common.Asc(BA.ObjectToChar("M")));
 //BA.debugLineNum = 1357;BA.debugLine="arr(2)=Asc(\"<\")";
_arr[(int)(2)] = (byte)(anywheresoftware.b4a.keywords.Common.Asc(BA.ObjectToChar("<")));
 //BA.debugLineNum = 1358;BA.debugLine="arr(3)=7";
_arr[(int)(3)] = (byte)(7);
 //BA.debugLineNum = 1359;BA.debugLine="arr(4)=MSP_SET_RC_TUNING";
_arr[(int)(4)] = (byte)(Double.parseDouble(_msp_set_rc_tuning));
 //BA.debugLineNum = 1360;BA.debugLine="arr(5)= (rcrate.text * 100)";
_arr[(int)(5)] = (byte)(((double)(Double.parseDouble(mostCurrent._rcrate.getText()))*100));
 //BA.debugLineNum = 1361;BA.debugLine="arr(6) = rcexpo.text * 100";
_arr[(int)(6)] = (byte)((double)(Double.parseDouble(mostCurrent._rcexpo.getText()))*100);
 //BA.debugLineNum = 1362;BA.debugLine="arr(7)= (RollPitchRate.text * 100)";
_arr[(int)(7)] = (byte)(((double)(Double.parseDouble(mostCurrent._rollpitchrate.getText()))*100));
 //BA.debugLineNum = 1363;BA.debugLine="arr(8)=(YawRate.text * 100)";
_arr[(int)(8)] = (byte)(((double)(Double.parseDouble(mostCurrent._yawrate.getText()))*100));
 //BA.debugLineNum = 1364;BA.debugLine="arr(9)= (ThrottlePidAtt.text * 100)";
_arr[(int)(9)] = (byte)(((double)(Double.parseDouble(mostCurrent._throttlepidatt.getText()))*100));
 //BA.debugLineNum = 1365;BA.debugLine="arr(10)= (throttleMid.text*100)";
_arr[(int)(10)] = (byte)(((double)(Double.parseDouble(mostCurrent._throttlemid.getText()))*100));
 //BA.debugLineNum = 1366;BA.debugLine="arr(11)= (throttleExpo.text*100)";
_arr[(int)(11)] = (byte)(((double)(Double.parseDouble(mostCurrent._throttleexpo.getText()))*100));
 //BA.debugLineNum = 1367;BA.debugLine="For i= 5 To 11";
{
final double step1113 = 1;
final double limit1113 = (int)(11);
for (_i = (int)(5); (step1113 > 0 && _i <= limit1113) || (step1113 < 0 && _i >= limit1113); _i += step1113) {
 //BA.debugLineNum = 1368;BA.debugLine="checksum =Bit.Xor(checksum,arr(i))";
_checksum = (byte)(anywheresoftware.b4a.keywords.Common.Bit.Xor((int)(_checksum),(int)(_arr[_i])));
 }
};
 //BA.debugLineNum = 1370;BA.debugLine="arr(12)=checksum";
_arr[(int)(12)] = _checksum;
 //BA.debugLineNum = 1371;BA.debugLine="Dim text As String";
_text = "";
 //BA.debugLineNum = 1372;BA.debugLine="textToSend=converter.StringFromBytes(arr,\"ISO-8859-1\")";
_texttosend = _converter.StringFromBytes(_arr,"ISO-8859-1");
 //BA.debugLineNum = 1373;BA.debugLine="TextWriter1.Write(textToSend)";
_textwriter1.Write(_texttosend);
 //BA.debugLineNum = 1374;BA.debugLine="TextWriter1.flush";
_textwriter1.Flush();
 //BA.debugLineNum = 1376;BA.debugLine="checksum=0";
_checksum = (byte)(0);
 //BA.debugLineNum = 1377;BA.debugLine="arr(0)= Asc(\"$\")";
_arr[(int)(0)] = (byte)(anywheresoftware.b4a.keywords.Common.Asc(BA.ObjectToChar("$")));
 //BA.debugLineNum = 1378;BA.debugLine="arr(1)=Asc(\"M\")";
_arr[(int)(1)] = (byte)(anywheresoftware.b4a.keywords.Common.Asc(BA.ObjectToChar("M")));
 //BA.debugLineNum = 1379;BA.debugLine="arr(2)=Asc(\"<\")";
_arr[(int)(2)] = (byte)(anywheresoftware.b4a.keywords.Common.Asc(BA.ObjectToChar("<")));
 //BA.debugLineNum = 1380;BA.debugLine="arr(3)=3*PIDITEMS";
_arr[(int)(3)] = (byte)(3*_piditems);
 //BA.debugLineNum = 1381;BA.debugLine="arr(4)=MSP_SET_PID";
_arr[(int)(4)] = (byte)(Double.parseDouble(_msp_set_pid));
 //BA.debugLineNum = 1382;BA.debugLine="arr(5)=GetView(0,1).text * 10";
_arr[(int)(5)] = (byte)((double)(Double.parseDouble(_getview((int)(0),(int)(1)).getText()))*10);
 //BA.debugLineNum = 1383;BA.debugLine="arr(6)=GetView(0,2).text * 1000";
_arr[(int)(6)] = (byte)((double)(Double.parseDouble(_getview((int)(0),(int)(2)).getText()))*1000);
 //BA.debugLineNum = 1384;BA.debugLine="arr(7)=GetView(0,3).text";
_arr[(int)(7)] = (byte)(Double.parseDouble(_getview((int)(0),(int)(3)).getText()));
 //BA.debugLineNum = 1385;BA.debugLine="For i=0 To 5";
{
final double step1130 = 1;
final double limit1130 = (int)(5);
for (_i = (int)(0); (step1130 > 0 && _i <= limit1130) || (step1130 < 0 && _i >= limit1130); _i += step1130) {
 //BA.debugLineNum = 1386;BA.debugLine="arr(8+3*i)=GetView(i,1).text * 10";
_arr[(int)(8+3*_i)] = (byte)((double)(Double.parseDouble(_getview(_i,(int)(1)).getText()))*10);
 //BA.debugLineNum = 1387;BA.debugLine="arr(9+3*i)=GetView(i,2).text * 1000";
_arr[(int)(9+3*_i)] = (byte)((double)(Double.parseDouble(_getview(_i,(int)(2)).getText()))*1000);
 //BA.debugLineNum = 1388;BA.debugLine="arr(10+3*i)=GetView(i,3).text";
_arr[(int)(10+3*_i)] = (byte)(Double.parseDouble(_getview(_i,(int)(3)).getText()));
 }
};
 //BA.debugLineNum = 1390;BA.debugLine="arr(26)= GetView(6,1).text*10";
_arr[(int)(26)] = (byte)((double)(Double.parseDouble(_getview((int)(6),(int)(1)).getText()))*10);
 //BA.debugLineNum = 1391;BA.debugLine="arr(27)=0";
_arr[(int)(27)] = (byte)(0);
 //BA.debugLineNum = 1392;BA.debugLine="arr(28)=0";
_arr[(int)(28)] = (byte)(0);
 //BA.debugLineNum = 1393;BA.debugLine="For i= 5 To 28";
{
final double step1138 = 1;
final double limit1138 = (int)(28);
for (_i = (int)(5); (step1138 > 0 && _i <= limit1138) || (step1138 < 0 && _i >= limit1138); _i += step1138) {
 //BA.debugLineNum = 1394;BA.debugLine="checksum =Bit.Xor(checksum,arr(i))";
_checksum = (byte)(anywheresoftware.b4a.keywords.Common.Bit.Xor((int)(_checksum),(int)(_arr[_i])));
 }
};
 //BA.debugLineNum = 1396;BA.debugLine="arr(29)=checksum";
_arr[(int)(29)] = _checksum;
 //BA.debugLineNum = 1397;BA.debugLine="Dim text As String";
_text = "";
 //BA.debugLineNum = 1398;BA.debugLine="textToSend=converter.StringFromBytes(arr,\"ISO-8859-1\")";
_texttosend = _converter.StringFromBytes(_arr,"ISO-8859-1");
 //BA.debugLineNum = 1399;BA.debugLine="TextWriter1.Write(textToSend)";
_textwriter1.Write(_texttosend);
 //BA.debugLineNum = 1400;BA.debugLine="TextWriter1.flush";
_textwriter1.Flush();
 //BA.debugLineNum = 1402;BA.debugLine="checksum=0";
_checksum = (byte)(0);
 //BA.debugLineNum = 1403;BA.debugLine="arr(0)= Asc(\"$\")";
_arr[(int)(0)] = (byte)(anywheresoftware.b4a.keywords.Common.Asc(BA.ObjectToChar("$")));
 //BA.debugLineNum = 1404;BA.debugLine="arr(1)=Asc(\"M\")";
_arr[(int)(1)] = (byte)(anywheresoftware.b4a.keywords.Common.Asc(BA.ObjectToChar("M")));
 //BA.debugLineNum = 1405;BA.debugLine="arr(2)=Asc(\"<\")";
_arr[(int)(2)] = (byte)(anywheresoftware.b4a.keywords.Common.Asc(BA.ObjectToChar("<")));
 //BA.debugLineNum = 1406;BA.debugLine="arr(3)=2*checkboxitems";
_arr[(int)(3)] = (byte)(2*_checkboxitems);
 //BA.debugLineNum = 1407;BA.debugLine="arr(4)=MSP_SET_BOX";
_arr[(int)(4)] = (byte)(Double.parseDouble(_msp_set_box));
 //BA.debugLineNum = 1408;BA.debugLine="For row=0 To 10";
{
final double step1152 = 1;
final double limit1152 = (int)(10);
for (_row = (int)(0); (step1152 > 0 && _row <= limit1152) || (step1152 < 0 && _row >= limit1152); _row += step1152) {
 //BA.debugLineNum = 1409;BA.debugLine="Dim a1 As Int";
_a1 = 0;
 //BA.debugLineNum = 1410;BA.debugLine="a1=0";
_a1 = (int)(0);
 //BA.debugLineNum = 1411;BA.debugLine="For i=2 To 7";
{
final double step1155 = 1;
final double limit1155 = (int)(7);
for (_i = (int)(2); (step1155 > 0 && _i <= limit1155) || (step1155 < 0 && _i >= limit1155); _i += step1155) {
 //BA.debugLineNum = 1412;BA.debugLine="If checkbox_switch(row,i-2).Checked= True Then";
if (mostCurrent._checkbox_switch[_row][(int)(_i-2)].getChecked()==anywheresoftware.b4a.keywords.Common.True) { 
 //BA.debugLineNum = 1413;BA.debugLine="a1 = a1 + Bit.ShiftLeft(1,i-2)";
_a1 = (int)(_a1+anywheresoftware.b4a.keywords.Common.Bit.ShiftLeft((int)(1),(int)(_i-2)));
 };
 }
};
 //BA.debugLineNum = 1417;BA.debugLine="Dim a2 As Int";
_a2 = 0;
 //BA.debugLineNum = 1418;BA.debugLine="a2=0";
_a2 = (int)(0);
 //BA.debugLineNum = 1419;BA.debugLine="For i=2 To 7";
{
final double step1162 = 1;
final double limit1162 = (int)(7);
for (_i = (int)(2); (step1162 > 0 && _i <= limit1162) || (step1162 < 0 && _i >= limit1162); _i += step1162) {
 //BA.debugLineNum = 1420;BA.debugLine="If checkbox_switch(row,i+4).Checked= True Then";
if (mostCurrent._checkbox_switch[_row][(int)(_i+4)].getChecked()==anywheresoftware.b4a.keywords.Common.True) { 
 //BA.debugLineNum = 1421;BA.debugLine="a2 = a2 + Bit.ShiftLeft(1,i-2)";
_a2 = (int)(_a2+anywheresoftware.b4a.keywords.Common.Bit.ShiftLeft((int)(1),(int)(_i-2)));
 };
 }
};
 //BA.debugLineNum = 1424;BA.debugLine="arr(5+2*row)=a1";
_arr[(int)(5+2*_row)] = (byte)(_a1);
 //BA.debugLineNum = 1425;BA.debugLine="arr(6+2*row)=a2";
_arr[(int)(6+2*_row)] = (byte)(_a2);
 }
};
 //BA.debugLineNum = 1427;BA.debugLine="For i= 5 To 26";
{
final double step1170 = 1;
final double limit1170 = (int)(26);
for (_i = (int)(5); (step1170 > 0 && _i <= limit1170) || (step1170 < 0 && _i >= limit1170); _i += step1170) {
 //BA.debugLineNum = 1428;BA.debugLine="checksum =Bit.Xor(checksum,arr(i))";
_checksum = (byte)(anywheresoftware.b4a.keywords.Common.Bit.Xor((int)(_checksum),(int)(_arr[_i])));
 }
};
 //BA.debugLineNum = 1430;BA.debugLine="arr(27)=checksum";
_arr[(int)(27)] = _checksum;
 //BA.debugLineNum = 1431;BA.debugLine="Dim text As String";
_text = "";
 //BA.debugLineNum = 1432;BA.debugLine="textToSend=converter.StringFromBytes(arr,\"ISO-8859-1\")";
_texttosend = _converter.StringFromBytes(_arr,"ISO-8859-1");
 //BA.debugLineNum = 1433;BA.debugLine="TextWriter1.Write(textToSend)";
_textwriter1.Write(_texttosend);
 //BA.debugLineNum = 1434;BA.debugLine="TextWriter1.flush";
_textwriter1.Flush();
 //BA.debugLineNum = 1436;BA.debugLine="checksum=0";
_checksum = (byte)(0);
 //BA.debugLineNum = 1437;BA.debugLine="arr(0)= Asc(\"$\")";
_arr[(int)(0)] = (byte)(anywheresoftware.b4a.keywords.Common.Asc(BA.ObjectToChar("$")));
 //BA.debugLineNum = 1438;BA.debugLine="arr(1)=Asc(\"M\")";
_arr[(int)(1)] = (byte)(anywheresoftware.b4a.keywords.Common.Asc(BA.ObjectToChar("M")));
 //BA.debugLineNum = 1439;BA.debugLine="arr(2)=Asc(\"<\")";
_arr[(int)(2)] = (byte)(anywheresoftware.b4a.keywords.Common.Asc(BA.ObjectToChar("<")));
 //BA.debugLineNum = 1440;BA.debugLine="arr(3)=MSP_EEPROM_WRITE";
_arr[(int)(3)] = (byte)(Double.parseDouble(_msp_eeprom_write));
 //BA.debugLineNum = 1441;BA.debugLine="Dim text As String";
_text = "";
 //BA.debugLineNum = 1442;BA.debugLine="textToSend=converter.StringFromBytes(arr,\"ISO-8859-1\")";
_texttosend = _converter.StringFromBytes(_arr,"ISO-8859-1");
 //BA.debugLineNum = 1443;BA.debugLine="TextWriter1.Write(textToSend)";
_textwriter1.Write(_texttosend);
 //BA.debugLineNum = 1444;BA.debugLine="TextWriter1.flush";
_textwriter1.Flush();
 };
 //BA.debugLineNum = 1447;BA.debugLine="End Sub";
return "";
}
public static String  _yawrate_click() throws Exception{
 //BA.debugLineNum = 668;BA.debugLine="Sub YawRate_Click";
 //BA.debugLineNum = 669;BA.debugLine="what_col=11";
_what_col = (int)(11);
 //BA.debugLineNum = 670;BA.debugLine="popup(YawRate.Text*100,1)";
_popup((int)((double)(Double.parseDouble(mostCurrent._yawrate.getText()))*100),(int)(1));
 //BA.debugLineNum = 672;BA.debugLine="End Sub";
return "";
}
}
